I have a ListView and binding ItemSource to a ICollectionView property, and binding selected item to a dp property.
public static readonly DependencyProperty SelectedProperty =
DependencyProperty.Register("Selected",
typeof(Myclass),
typeof(MyControl), new PropertyMetadata(SelectedContactChange));
static void SelectedContactChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
MyControlcontrol = d as MyControl;
control.MYView = CollectionViewSource.GetDefaultView(((Myclass)e.NewValue).Numbers);
}
and i have another list view and binding itemsource to MYView propert.
ICollectionView _myView;
public ICollectionView MYView
{
get { return _myView; }
set
{
_myView= value;
}
}
When change the SelectedProperty i set value for MYView, but don’t show new value in listview that binding with MYView!!!
How to change MYView property when changed SelectedProperty ??
Not 100% sure, but i guess that your ListView’s ItemsSource is bound to the
MYViewproperty of your MyControl class, perhaps like this:When you now change the value of the
MYViewproperty, there is no mechanism that notifies the binding of the change. You should implement INotifyPropertyChanged and raise the PropertyChanged event whenMYViewchanges:Alternatively, you could define
MYViewas another dependency property.