Not 100% sure, but i guess that your ListView's ItemsSource is bound to the MYView
property of your MyControl class, perhaps like this:
<MyControl x:Name="myControl" ... />
<ListView ItemsSource="{Binding MYView, ElementName=myControl}" />
When you now change the value of the MYView
property, there is no mechanism that notifies the binding of the change. You should implement INotifyPropertyChanged and raise the PropertyChanged event when MYView
changes:
public class MyControl : UserControl, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public ICollectionView MYView
{
get { return _myView; }
set
{
_myView = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("MYView"));
}
}
}
}
Alternatively, you could define MYView
as another dependency property.