Q: Update WindowsFormsHost Control from DP Callback WPF I have a usercontrol wrapper around a DataGridView in a WindowsFormsHost.
The wrapper has a DP with a callback, but the callback is static so it cannot simply execute code on the windowsforms hosted control that has an x:Name.
How can I update the WindowsFormsHost DataGridView when the DP gets updated?
I want to do something like this, but I cannot reference _gridView in the DP callback
 public LiteTable GridViewData
    {
        get { return (LiteTable)GetValue(GridViewDataProperty); }
        set { SetValue(GridViewDataProperty, value); }
    }

    private static void OnGridViewDataChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
    {
        _gridView.GetData((LiteTable)e.NewValue);
    }

    // Using a DependencyProperty as the backing store for GridViewData.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty GridViewDataProperty =
        DependencyProperty.Register("GridViewData", typeof(LiteTable), typeof(LiteGridViewWrapper), new UIPropertyMetadata(null, OnGridViewDataChanged));


A: WPF passes the instance whose property changed in the source parameter.
You can cast this parameter to your type and get the field.
var me = (MyControl)source;
me._gridView.GetData((LiteTable)e.NewValue);

