I'm not sure if this is a problem with the DataGrid control or with MultiSelectors in general, but when I select multiple rows in the grid, the CollectionChanged event is fired for each individual row. It makes sense if I “drag and drop” with my mouse, but it also happens if I “change” to select several rows or just click the “Select all all rows” button in the upper left.
I saw on MultiSelector that there are Begin / EndUpdateSelectedItems methods, as well as the IsUpdatingSelectedItems property. Unfortunately, my consumer of this collection / event does not know its source.
Is there a way to get the DataGrid / SelectedItems collection to send a CollectionChanged notification only after the update is complete?
Thank you.
Edit: I found that for the DataGrid, the IsUpdatingSelectedItems property is not set even when changing a large selection.
Edit: I found that the DataGrid SelectionChanged event correctly fires only once after a complete change. This is sad since it destroys the ability to simply bind data, but it is a potential workaround if you have consumer control over the SelectedItems collection.
source share