Ranjithkumar
Ranjithkumar

Reputation: 18386

Drag & Drop in Xamarin forms

How do we add drag & drop functionality in Xamarin..

After lot of googling I found the following official link for drag & drop for xamarin..

https://blog.xamarin.com/android-tricks-supporting-drag-and-drop-in-an-app/

But it uses the android native code only.

My questions:

  1. In Xamarin is it possible to implement drag & drop functionality without native codes?

  2. If answer - No -> How do we achieve the drag & drop listeners for all platforms?

I searched google & the official forum and nothing found.. Someone help me..Thanks..

Upvotes: 14

Views: 8026

Answers (3)

valentasm
valentasm

Reputation: 2382

2020 it looks like we have it. You still need to set up DragAndDrop_Experimental flag.

https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/gestures/drag-and-drop

Upvotes: 1

ClintL
ClintL

Reputation: 1453

Xamarin.Forms does not appear to support that kind of touch. Event handlers for on touch would have to be written in the native implementations with a dependency injection pattern for accessing them from the shared code.

The only built in gestures recognized are tap, pinch and pan.

Using the below link it should not be too difficult to get drag and drop up and running.

https://developer.xamarin.com/guides/cross-platform/application_fundamentals/touch/

https://developer.xamarin.com/guides/xamarin-forms/dependency-service/introduction/

Upvotes: 1

Related Questions