Hi,
I have RichEditBox and class with DependencyPropert:
public class RichTextC : DependencyObject
{
public static string GetRichText(DependencyObject obj)
{
return (string)obj.GetValue(RichTextProperty);
}
public static void SetRichText(DependencyObject obj, string value)
{
obj.SetValue(RichTextProperty, value);
}
public static readonly DependencyProperty RichTextProperty =
DependencyProperty.Register("RichText", typeof(string), typeof(RichTextC), new PropertyMetadata(string.Empty, callback));
private static void callback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var reb = (RichEditBox)d;
reb.Document.SetText(TextSetOptions.FormatRtf, (string)e.NewValue);
}
}
And this is my RichEditBox
<RichEditBox local:RichTextC.RichText="{Binding MyRichText, Mode=TwoWay}"/>
Problem is, that View can be notified by the View Model, but when I change text in RichEditBox it not notify View Model. I mean, binding working only in one way, from View Model to View, but from View to View Model does not work.
How can I change it to two-way binding start working?