0
WindowsFormsHostのDataGridViewの周囲にユーザーコントロールラッパーがあります。DPコールバックからWindowsFormsHostコントロールを更新するWPF
ラッパーにはコールバック付きのDPがありますが、コールバックは静的であるため、x:Nameを持つwindowsformsホストコントロールでコードを実行するだけでは機能しません。
DPが更新されたら、WindowsFormsHost DataGridViewをどのように更新できますか?
私はこのような何かをしたいが、私はDPコールバックで_gridViewを参照することはできません
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