roubachof / Sharpnado.CollectionView

A performant list view supporting: grid, horizontal and vertical layout, drag and drop, and reveal animations.
The Unlicense
244 stars 30 forks source link

DragAndDropInfo provides incorrect information for moved item #27

Closed ewerspej closed 3 years ago

ewerspej commented 3 years ago

Platform (please complete the following information):

Describe the bug The DragAndDropInfo provides an incorrect object that has been moved on iOS. When I move an item by one position, I receive the item that was in the new position instead of the actual item which was moved to that new position. Also, it seems that on both platforms, the From and To properties are reversed.

To Reproduce Steps to reproduce the behavior:

  1. Create a HorizontalListView with Drag and Drop enabled
  2. Add a handler for the DragAndDropEndedCommand
  3. Drag and Drop an item to a new position
  4. Interrogate the DragAndDropInfo object on both iOS and Android
  5. You'll see that the From and To properties are the wrong way around and that on iOS the returned object is not the one that was moved, but instead the one that was previously in the position that the moved item got dropped to.

This is urgent, because I cannot release a feature I'm working on with this behaving different on iOS than on Android and I am not a fan of workarounds. A quick response and possible fix would be much appreciated! :)

Update: For now, I've implemented a workaround, because it's a one-liner, which is less work than fixing the actual issue and also goes much faster than waiting for an update to the nuget. However, this should be fixed, because Drag and Drop currently isn't exactly doing what it is supposed to do.

ewerspej commented 3 years ago

@roubachof This is still important, but not urgent anymore as I've found away around this problem. I'd like to get rid of the workaround eventually, though. If I have some spare time, I might look into a solution myself and provide a PR.

umar15baig commented 3 years ago

@ewerspej Can you please tell me about that workaround you are talking about ? Thanks

roubachof commented 3 years ago

in fact the info are inversed:

'from' is 'to' and 'to' is 'from' x)

ewerspej commented 3 years ago

@ewerspej Can you please tell me about that workaround you are talking about ? Thanks

@umar15baig , instead of using the Content object from the DragAndDropInfo, I'm accessing the object myself in my underlying collection and instead of the To position, I'm simply using the From position (which will break obviously, once a fix is available):

var draggedElement = MyCollection[dragDropInfo.From];

That solved the immediate issue for my use case. Your use case might be different.

ewerspej commented 3 years ago

in fact the info are inversed:

'from' is 'to' and 'to' is 'from' x)

LOL, yes!

roubachof commented 3 years ago

just be aware, it will be fixed in next version (next week) :)

ewerspej commented 3 years ago

nice! thanks for the info :)

roubachof commented 3 years ago

fixed by 1.8.2