This project has moved. For the latest updates, please go here.

RichTextBox update on Viewmodel property update

Jan 3, 2011 at 7:29 AM

Hi,

Extended WPF Toolkit RichTextbox does not update when the ViewModel Property associated with it is changed in the code-behind file or from any other file. And the same feature works fine with the regular WPF RichTextbox. 

I chose toolkit RichTextBox because of its Binding Property and RTF.

Below is the sample code for reference:

UserControl.xaml

<toolkit:RichTextBox Name="rtbTest" Text="{Binding Path=EmployeeName,UpdateSourceTrigger=PropertyChanged}" Height="70" Width="263"/>            

UserControl.xaml.vb

Dim emp As Employee = Me.DataContext

emp.EmployeeName = "XYZ"

Please provide me with your feedback.

Note: I have implemented the ViewModel with INotifyPropertyChanged.

Thanks,

Chitz

 

Jan 3, 2011 at 5:02 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jan 3, 2011 at 5:14 PM
Chitz wrote:

Hi,

Extended WPF Toolkit RichTextbox does not update when the ViewModel Property associated with it is changed in the code-behind file or from any other file. And the same feature works fine with the regular WPF RichTextbox.  

 The regualr WPF RichTextBox doesn't have the Text binding feature, so it can't work :0).  Anyways, there is a reason for this behavior.  There is code that checks if the Text has already been set, and if it has it doesn't set the Text again.  This is becaseu if you are using the UpdateSourceTrigger = PropertyChanged, the cursor would jump to the front of the RichTextBox everytime a letter is typed.  I will try to fix this behavior without a major performance hit.

Jan 3, 2011 at 6:56 PM

This issue has been resolved.  Please download the latest source code and give it a try.