SYL SYL - 22 days ago 14
C# Question

UWP Raise ObservableCollection CollectionChanged

Windows 10 UWP C#

I have a class for ListView grouping from MSDN example:

public class GroupInfoList : List<object>
{
public object Key { get; set; }
}


Also I have grouped collection which is binded to
CollectionViewSource
and
ListView
:

ObservableCollection<GroupInfoList> TransactionsCollection
= new ObservableCollection<GroupInfoList>();


When I add or remove some items from collection nothing happens. The
CollectionChanged
Event not raising.

Delete example:

foreach (var x in TransactionsCollection)
{
if (x.Key.ToString() == item.displayGroupName)
{
x.Remove(x.Find(i => ((Transaction)i).Id == item.Id));
return;
}
}


How I can call
CollectionChanged
Event?

SYL SYL
Answer

This code works:

public class GroupInfoList : ObservableCollection<object>
{
    public object Key { get; set; }
}