I have some collection that implements INotifyCollectionChanged.
public sealed class GroupCollection : INotifyCollectionChanged, IList<Group>
{
//...
public event NotifyCollectionChangedEventHandler CollectionChanged;
private void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
{
if (CollectionChanged != null)
{
CollectionChanged(this, e);
}
}
//...
}
It is used in xaml
<CollectionViewSource x:Name="groupedItemsViewSource" Source="{Binding Groups}"/>
then in xaml.cs
this.DefaultViewModel["Groups"] = groups.GroupCollection;
Collection items are displayed just fine. But UI does not subscribe to CollectionChanged
and doesn't updates itself when CollectionChanged
is fired. Maybe I need to implement more interfaces to make UI control subscribe to event?
P.S. I cannot use ObservableCollection because compiler says that this "is not a Windows Runtime interface".