Привязка WPF к пользовательскому свойству в пользовательском элементе управления

У меня есть пользовательское текстовое поле, определенное следующим образом:

public class CustomTextBox : TextBox
{
    public static DependencyProperty CustomTextProperty = 
             DependencyProperty.Register("CustomText", typeof(string), 
             typeof(CustomTextBox));

    static CustomTextBox()
    {
        TextProperty.OverrideMetadata(typeof(SMSTextBox),
                      new FrameworkPropertyMetadata(string.Empty,
                      FrameworkPropertyMetadataOptions.Journal |
                          FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
                      new PropertyChangedCallback(CustomTextBox_OnTextPropertyChanged));
    }

    public string CustomText
    {
        get { return (string)GetValue(CustomTextProperty); }
        set { SetValue(CustomTextProperty, value); }
    }

    private static void CustomTextBox_OnTextPropertyChanged(DependencyObject d,
                     DependencyPropertyChangedEventArgs e)
    {
        CustomTextBox customTextBox = d as CustomTextBox;

        customTextBox.SetValue(CustomTextProperty, e.NewValue);
    }
}

Я связываю свойство Custom Text в XAML -

<local:CustomTextBox CustomText="{Binding ViewModelProperty}" />

Проблема, с которой я сталкиваюсь, заключается в том, что при вводе чего-либо в CustomTextBox изменения не отражаются в ViewModelProperty, т. Е. ViewModelProperty не обновляется. CustomTextProperty обновляется, но я полагаю, мне нужно сделать что-то дополнительное, чтобы привязка также работала.

Что я не делаю? Буду признателен за любую помощь в этом.

Спасибо

Ответы на вопрос(1)

Ваш ответ на вопрос