xamarin-forms-samples
xamarin-forms-samples copied to clipboard
[Bug] Drag a file and Drop into App raises ArgumentNullException
Description
As instructed in Xamarin Drag and Drop documentation, Drag and Drop can "start in one application and end in another". However, when drag a file/image (e.g., file icon on desktop) from other app or File Explorer, exception got raised in OnDrop event.
Steps to Reproduce
- Create a Frame inside a ContentPage and set DropGestureRecognizer in it.
- Build and Run.
- Drag a file icon from File Explorer and drop it inside the Frame in the Xamarin UWP app.
Expected Behavior
The dropped file's full path get passed into the OnDrop event.
Actual Behavior
Raises exception in OnDrop: "System.ArgumentNullException: Value cannot be null.\r\nParameter name: view\r\n at Xamarin.Forms.DropEventArgs..ctor(DataPackageView view)\r\n at Xamarin.Forms.Platform.UWP.VisualElementTracker`2.HandleDrop(Object sender, DragEventArgs e)"
Information
- IDE and IDE version: Visual Studio 2019 v16.8.6
- Platform with the issue:
- UWP: SDK 19041
Drag and Drop file from outside the App is very useful. Please help. Thanks a lot.
Were you able to fix the problem? I have exactly the same problem and could need some advice.
Sadly, no fix or workaround found. I've gave up on using this Drag and Drop functionality.