How to bind text to the RichTextbox from view model.
Sahithi-Snovasys opened this issue · 2 comments
Sahithi-Snovasys commented
I would like to bind the string(Combination of emoji and some string) as a text from view model to richtext box. Is there any way to bind it.
Also, how to get entered text from richtextbox
ZuiMelanieForno commented
Hi.
No. But...
The RichTextBox uses a "FlowDocument" instead of a "pure" Text. (Strings)
There is a way to Bind to a "extended" RichTextBox-Control in the "Extended WPF Toolkit".
They already solved the "bindability" to a String-Property.
If this is not for You, you can extend a RichTexBox with a DependencyProperty.
I hope it helps...
c.u.
samhocevar commented
@sahithi89 in the latest release you can bind Text
on the RichTextBox
. See the new version of the sample application:
<emoji:RichTextBox FontSize="20" x:Name="EmojiRichTextBox"/>
<emoji:TextBlock FontSize="12" Text="{Binding Text, ElementName=EmojiRichTextBox, Mode=TwoWay}"/>