我有一個UserControl
名爲MultiChartControl
,它有一個名爲MultiChartInputDetails
的依賴項屬性。DependencyPropertyChanged回調事件沒有被觸發
public ChartsData MultiChartInputDetails
{
get { return (ChartsData)GetValue(MultiChartInputDetailsProperty); }
set { SetValue(MultiChartInputDetailsProperty, value); }
}
public static readonly DependencyProperty MultiChartInputDetailsProperty =
DependencyProperty.Register("MultiChartInputDetails", typeof(ChartsData), typeof(MultiChartControl), new UIPropertyMetadata(new PropertyChangedCallback(MultiChartInputDetailsChanged)));
但接下來的回調方法不會被解僱甚至一度:
private static void MultiChartInputDetailsChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
{
MultiChartControl chart = d as MultiChartControl;
if (chart != null)
{
if (chart.ChartGrid.Children != null)
chart.ChartGrid.Children.Clear();
chart.InitilizeData();
}
MessageBox.Show("MultiChartInputDetailsChanged fired");
}
和主主控:
<multicharting:MultiChartControl x:Uid="multicharting:MultiChartControl_1"
MultiChartInputDetails="{Binding Path=MultiChartsInputDetails, ElementName=Chart, Converter={StaticResource DebugConverter}}"/>
是否結合產生一個有效的價值? – Clemens