Hi i am working with WPF and using the MVVM pattern. So my problem is that i am trying to bind the selected text of a RichTextBox to a property in my ViewModel but i can’t bind the Selection property.
So how can i do it?
Binding the Selection property of the RichTextBox to a property in my ViewModel is the way that i think is better to apply effects and decorations to the text.
If anyone knows a better way to know in the ViewModel the selected text of the RichTextBox, let me know. I am starting to learn about FlowDocuments and working with the RichTextBox so it’s why i am a bit lost.
Thanks in advance!
You could use a
Behavior:XAML usage:
(where
SelectedTextis a string property on your ViewModel)