This is a migrated thread and some comments may be shown as answers.
Updating TextBox from ViewModel
12 Answers 72 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Peter
Top achievements
Rank 1
Peter asked on 18 Jun 2012, 06:30 PM
Hi,

When setting the text of a TextBox by modifying the variable it is bound to, both the text and the watermark are showing.

Set-up: Text field of a TextBox databound (two-way) to a variable on a ViewModel
Action: Changing the variable on the ViewModel updates the Text property on-screen accordingly
Problem: The watermark does not disappear until the TextBox gets focus by tapping on it

Bug or feature :-) ?

12 Answers, 1 is accepted

Sort by
0
Vijay
Top achievements
Rank 1
answered on 19 Jun 2012, 05:49 AM
Hello Peter,

   This may be caused because you might have specified an additional watermark property with some holding text. Please find the below sample code, where the watermark property is included. If you don't actually specify this property this will not show up in RadTextBox.

<primitives:RadTextBox ActionButtonVisibility="Visible" Watermark="Enter FirstName Here" Header=”Please Enter FirstName”/>


Thanks and Regards,
Vijay
MVC Corp
0
Todor
Telerik team
answered on 19 Jun 2012, 10:32 AM
Hi Peter,

I tried to reproduce the issue described but couldn't. I have added a sample application to illustrate how RadTextBox works perfectly when bound to property from a ViewModel and the watermark disappears when the text is changed just as expected.

Let me know, if there is anything else more specific in your scenario.

Regards,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 19 Jun 2012, 08:32 PM
Hi Vijay,

Based on your feedback I dug a little deeper and narrowed it down to this:

- I have two views working on the same viewmodel
- view 1 has a couple of controls databound to variables on the viewmodel 
- one of those is a textbox 
- the controls can be prefilled by going to a second view where the user can pick some entity from a list
- based on the selection view 2 updates the viewmodel and navigates back to view 1
- when view 1 is displayed, both the watermark and the text are showing

I've put the above logic in a small sample showing the issue but am unable to attach the zip file to this post... 

Thanks,

Peter
0
Vijay
Top achievements
Rank 1
answered on 20 Jun 2012, 03:34 AM
Hello Peter,


   As known, .zip extension files or .zwf extension files cannot be attached to forums for some security concerns. If you wish to send the source code you may raise support ticket where the telerik team can look into your request. Either way to send your implementation logic would be, you can add code block in forums section or send us some images where scenario can be understood clearly.

Please don't hesitate to connect us, for any further clarifications. 

Thanks and Regards,
Vijay
MVC Corp.
0
Pierre Huguet
Top achievements
Rank 2
answered on 21 Jun 2012, 03:59 AM
I have the Same Problem the watermark stays on top of a databound TextBox
Until the textbox gets edited.
0
Todor
Telerik team
answered on 22 Jun 2012, 11:06 AM
Hi,

We still can't reproduce the issue that you are describing even when following you scenario. As Vijay explained, you should open a new support ticket in order to be able to attach a project and send it to us. This would help us a lot as we will be able to debug it and find exactly what is causing the undesired behavior.

Thank you for your time.

All the best,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Ingrid
Top achievements
Rank 1
answered on 22 Jun 2012, 12:40 PM
Hi, 

I just filed a bug related to this topic using our company account and attached a screenshot and zip file.
Have been out for a couple of days, sorry for the delay...

Peter
0
Todor
Telerik team
answered on 22 Jun 2012, 01:55 PM
Hi Johan,

Thank you for the provided application. We will see what is causing the issue and will let you know when the fix is ready.

Thank you for your time.

All the best,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Mikael
Top achievements
Rank 1
answered on 09 Jul 2012, 04:45 AM
You can reproduce the error with a small modification to the example provided by Todor. Just set the initial text in the constructor of the ViewModel:

        public MainViewModel()
        {
             this.TextBoxValue = "Initial value";
        }

0
Mikael
Top achievements
Rank 1
answered on 09 Jul 2012, 06:36 AM
Ok, this is a stupid hack but seems to get around the problem. Instead of setting the value directly in the view model's constructor, use ThreadPool.QueueUserWorkItem to delay the operation. For example:

        public MainViewModel()
        {
            ThreadPool.QueueUserWorkItem(x =>
                                             {
Thread.Sleep(300);


this.TextBoxValue = "Initial value";
                                             });
        }

If you're not using Caliburn.Micro, make sure to use Dispatcher to set the value.
0
Todor
Telerik team
answered on 09 Jul 2012, 07:46 AM
Hello Michael,

Thank you for sharing your workaround.

We have resolved this issue and you will be able to get the fix with our next internal build that will be released later this week.

Kind regards,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Todor
Telerik team
answered on 11 Jul 2012, 07:06 AM
Hi,

I am happy to inform you that you can now download our latest internal build from the downloads section of your accounts. You should no longer see both watermark and text in the same time in RadTextBox.

Greetings,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TextBox
Asked by
Peter
Top achievements
Rank 1
Answers by
Vijay
Top achievements
Rank 1
Todor
Telerik team
Peter
Top achievements
Rank 1
Pierre Huguet
Top achievements
Rank 2
Ingrid
Top achievements
Rank 1
Mikael
Top achievements
Rank 1
Share this question
or