I have created a custom RichTextBox control and exposed a Text property. The Text property is defined as follows:
public string Text
{
get
{
return new TextRange(Document.ContentStart, Document.ContentEnd).Text;
}
set
{
AppendText(value);
OnPropertyChanged("Text");
}
}
The RichTextBox is using a ViewModel as DataContext as shown below:
<WPF:SharpRichTextBox MaxCharactersAllowed="100" NotificationStyleName="defaultTextBlockStyle"
Text="{Binding Path=Name, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
DefaultNotificationStyleName="textblockStyle" Margin="10,10,10,10" Background="Yellow">
</WPF:SharpRichTextBox>
Now I want that whenever I change the Text of the RichTextBox the "Name" property in the ViewModel gets updated. How can I do that?