1
J'ai un contrôle d'édition hautement personnalisé qui hérite RichTextBox
. J'avais besoin d'un moyen de lier un Value
à ce contrôle, donc j'ai enregistré un nouveau DependencyProperty
, mais j'ai du mal à le coder comme j'ai besoin.DependencyProperty avec la liaison TwoWay
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(string), typeof(XliffRichCellEditor),
new PropertyMetadata(new PropertyChangedCallback(XliffRichCellEditor.OnValuePropertyChanged)));
public String Value
{
get { return (String)this.GetValue(ValueProperty); }
set { this.SetValue(ValueProperty, value); }
}
private static void OnValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// Need to change Document in RichTextBox when Binding Source is changed
// But also ignore if the change comes from RichTextBox which is only updating
// the DependencyProperty. In this case Binding Source should be updated.
}
Aidez-nous s'il vous plaît.