Hello,
ObservableCollection<T> class provides notifications internally when items get added or removed, or when the whole list is refreshed.
So, you don't have to implement the OnPropertyChanged();
method in the set method of CustomList
. And you could delete
private ObservableCollection<CustomModel> customList;
public ObservableCollection<CUstomModel> CustomList.....
adding and updating dynamically whenever required, while doing that its take lot of time to update
When you want to add the item, please call CustomList.Add(item)
When you want to set other groups and update the itemsource, you could remove all items in the ObservableCollection
, then add new items.
For example:
CustomList.Clear();//remove all items
if (CustomList.Contains(item))
{
CustomList.Remove(item);// remove a item
}
Best Regards, Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.