I have an observable collection and I have a collectionChanged event wired up on that.
I have its items bound to a listbox in the UI.
When the user removes some items in the UI from the listbox, the CollectioChanged gets fired properly, however, I need to know the indices of the items that were removed.
The problem is I am not able to an indexOf on the collection after it is changed because it does not have the removed item anymore..
Can we get access to the list of indexes that were removed from an ObservableCollection from the collectionchanged event?
The
CollectionChangedevent uses an event that gives you aNotifyCollectionChangedEventArgs. This has aOldStartingIndexproperty, which will tell you the index it was removed at. For example:The event will most likely fire multiple times, once for each item.