Создан Bindable WindowsFormsHost, но дочернее обновление не отражается на элементе управления

Я столкнулся с проблемой, когда я хочу привязать элемент управления к элементу управления windowsFormsHost. Но, как мы все знаем, свойство Child не является DP, поэтому я создал обертку.

/// <summary>
    ///     Bindable version of windows form hosts
    /// </summary>
    public class BindableWindowsFormsHost : WindowsFormsHost
    {
        /// <summary>
        /// Max value of the textbox
        /// </summary>
        public Control BindableChild
        {
            get { return (Control)GetValue(BindableChildProperty); }
            set 
            {
                SetValue(BindableChildProperty, value);
            }
        }

        // Using a DependencyProperty as the backing store for Max.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty BindableChildProperty =
            DependencyProperty.Register("BindableChild", typeof(Control), typeof(BindableWindowsFormsHost),  new FrameworkPropertyMetadata(new PropertyChangedCallback(OnBindableChildChanged)));

        /// <summary>
        /// Handles changes to the FlyoutWindowSize property.
        /// </summary>
        private static void OnBindableChildChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((WindowsFormsHost)d).Child = e.NewValue as Control;
        }
    }

e.NewValue получает нужный мне элемент управления и устанавливает его правильно, НО я не вижу отражения изменений. Дочерний элемент установлен, но не может видеть windowsFormsHost с новым элементом управления.

У кого-нибудь есть идеи?

Спасибо и С уважением, Кев84

8
задан Kev84 16 July 2012 в 18:10
поделиться