Even better drag and drop with DragAndDropTrigger and DragAndDropDirection


DragAndDropTrigger and DragAndDropDirection

You can now choose if you want to begin the drag and drop with a Pan gesture or a LongPress.

  • DragAndDropTrigger="Pan"
  • DragAndDropTrigger="LongTap"

You can also restrict the drag movement to a given direction:

  • For the horizontal layout: DragAndDropDirection = HorizontalOnly
  • For the vertical layout: DragAndDropDirection = VerticalOnly

It will give a better more precise drag experience, more precise.

A PR from the community

I'm so happy that people are getting into the Sharpnado boat for a nice cruise.
This time this is Pavlo Lukianets that brought this gem to us.

sharpnado: So Mister Onion, why are you using Sharpnado's HLV?

themronion: Sharpnado HLV is really the one and only open source plugin out here in the web that supports drag and drop. Unfortunately the XF team didn't prioritize the drag and drop support in a CollectionView so here comes the mighty Sharpnado :D

sharpnado: ahah the silly mighty Sharpnado, but why did you need those features for?

themronion:: Our project is a taxi app and one of our requirements was to make a reorderable route. We have a list of points and we had to make them draggable and reorderable. After reordering the price is recalculated and the route is changed.

We were satisfied with the current implementation that HLV provide, but decided to make it even more flexible when it comes to drag and dropping. Since the list of our route points has only one function (to be reordered) we decided why should we wait for the drag to start on Android. So we (i) implemented the Pan DragAndDropTrigger on Android.

We went further and decided - since it is a vertical list the user must only drag vertically - hence i implemented the DragAndDropDirection.

sharpnado: NOICE, but why you decided to do it yourself?*

themronion:: That's an easy one. I am the only Xamarin programmer on my team, so who else? :)