There is a custom control
<ctrls:SearchDefalut Source="{Binding SearchResults}"
Height="40" Width="180"/>
I have a dependent property called Source
public IEnumerable Source
{
get { return (IEnumerable)GetValue(SourceProperty); }
set { SetValue(SourceProperty, value); }
}
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
public static readonly DependencyProperty SourceProperty =
DependencyProperty.Register("Source", typeof(IEnumerable), typeof(SearchDefalut), new PropertyMetadata(null,OnMySourcePropertyChanged));
private static void OnMySourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
//TODO
}
When I use the command to trigger the SearchResults add or remove data dependency property OnMySourcePropertyChanged Source will not be call it makes me feel very confused
<ctrls:SearchDefalut Source="{Binding SearchResults,Mode=TwoWay}"
Height="40" Width="180"/>
<ctrls:SearchDefalut Source="{Binding SearchResults,Mode=OneWaySource}"
Height="40" Width="180"/>
So I tried to change the Mode but it still didn’t work