0
我在WindowsFormsHost的DataGridView中有一個用戶控件包裝器。從DP回調中更新WindowsFormsHost控件WPF
包裝器有一個帶回調的DP,但回調是靜態的,所以它不能簡單地在windowsforms託管的控件上執行具有x:Name的代碼。
如何在更新DP時更新WindowsFormsHost DataGridView?
我想要做這樣的事情,但我不能在DP回調
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));
謝謝你,完美的作品! – ChandlerPelhams