microsoft-ui-xaml
microsoft-ui-xaml copied to clipboard
ListView reorder item triggers ObservableCollection Remove and Add instead of Move
Describe the bug
It seems to be a history problem but it still confusing me that reorder item doesn't trigger ObservableCollection.Move method. I want to detect if some item is reordered, however I can not find any solution. Default ListView reordering behavior is remove item from the ObservableCollection and then add item to the ObservableCollection. Hence I can not determine whether item is reorder or add/remove. It's so weird. Is there any solution to detect reordering?
Steps to reproduce the bug
- Place a ListView with a ObservableCollection ItemSource and enable ListView reorder ability
- Add event handler to the ObservableCollection's CollectionChanged
- Reorder item in ListView and CollectionChanged was triggered twice. One is remove event and the other is add event.
Expected behavior
ObservableCollection's CollectionChanged should be triggered only once with NotifyCollectionChangedAction=Move
Screenshots
No response
NuGet package version
None
Windows version
No response
Additional context
No response