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

Is it possible to enable Drag and Drop from a control in a DataTemplate instead of the whole template? #34

Closed phillfox closed 1 year ago

phillfox commented 3 years ago

Is your feature request related to a problem? Please describe. I tried to use HorizontalListView in Vertical mode to allow the user to reorder a collection, but if the whole collection doesn't fit in the view there is no way to scroll your view when Drag and Drop is enabled. I've got a list that has 99 items, most of them are only visible if you scroll the HLV. When in Drag and Drop mode, I can only reorder the items on screen.

Describe the solution you'd like I'd like ability to add a specific 'HLV Drag and Drop' control to the template, or apply the Drag and Drop commands to a specific control in the template, not the whole DataTemplate. That way, the user can touch and drag anywhere but the 'Drag and Drop' control to scroll the view, then tap and drag on the 'Drag and Drop' control to reorder.

Describe alternatives you've considered I started by adding the drag and drop gestures to a control inside my DataTemplate, but that just let me drag that control, not the DataTemplate, and the drop was unhandled (because I wasn't dragging the DataTemplate). I then added a custom 'touchstarted' renderer and added a control that implements that gesture as a child control in my DataTemplate. When the user 'taps' the control I fire a command that switches the HLV set EnableDragAndDop = true. This works, but you can't tap and then drag, you have to touch to enable drag and drop then lift and touch again to start your drag.

Additional context SyncFusion has a control that allows this behavior, I will continue using it. But I'd be happy to help implement this and submit a pull request; I just have no idea what else to try in order link the control's drag gesture to the template.

roubachof commented 2 years ago

Drag and dropping an item at the edge of screen triggers a scroll on the list, so you should be able to drag and drop outside of screen bounds. The sample in this project features such a case, go to the vertical layout and enable the switch :)