Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListView reorder item triggers ObservableCollection Remove and Add instead of Move #9685

Open
HHaoWang opened this issue May 30, 2024 · 3 comments
Labels
area-Lists ListView, GridView, ListBox, etc feature proposal New feature proposal team-Controls Issue for the Controls team

Comments

@HHaoWang
Copy link

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

  1. Place a ListView with a ObservableCollection ItemSource and enable ListView reorder ability
  2. Add event handler to the ObservableCollection's CollectionChanged
  3. 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

@HHaoWang HHaoWang added the bug Something isn't working label May 30, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label May 30, 2024
Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@codendone codendone added area-Lists ListView, GridView, ListBox, etc team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Jun 7, 2024
@ranjeshj ranjeshj added feature proposal New feature proposal and removed bug Something isn't working labels Jun 28, 2024
@fabianoriccardi
Copy link

I can confirm this issue, that, IMHO, is a bug and not a feature request.

Which developer would think that a reordering gesture triggers a couple of add-remove notifications instead of a Move one?

@HHaoWang
Copy link
Author

I can confirm this issue, that, IMHO, is a bug and not a feature request.

Which developer would think that a reordering gesture triggers a couple of add-remove notifications instead of a Move one?

I cannot agree it more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Lists ListView, GridView, ListBox, etc feature proposal New feature proposal team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

4 participants