picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.56k stars 325 forks source link

WPF Drag'n'Drop doesn't work on Window #1852

Open onepiecefreak3 opened 3 years ago

onepiecefreak3 commented 3 years ago

Expected Behavior

I expect to be to drag and drop files on my WPF application and get their information (like the FilePath) in the DragDrop event on the form.

Actual Behavior

The drop action is disallowed on the WPF platform, even though near to nothing is placed on the Form itself (just a StackLayout with the Text "Hello World", which is the preset content for an Eto app) and the AllowDrop property is set to true, before anything is placed in the Content control.

Steps to Reproduce the Problem

  1. Download the sample project
  2. Open it in VS
  3. Start it in debug mode, and maybe set a breakpoint at the end of the DragDrop event method in MainForm.cs
  4. Drag and drop a file onto the form and try to reach the breakpoint.

Code that Demonstrates the Problem

DragDropExample.zip

Specifications

InfinityGhost commented 3 years ago

The form itself as far as I'm aware doesn't support drag and drop, it needs a catalyst to handle it. Seems to be the same between all the platforms I've used (WPF, GTK, Mac64)

cwensley commented 3 years ago

As @InfinityGhost pointed out, using the content control vs. the form/window to handle the drag events should work. We could make this work by forwarding these events to the content controls in Eto, but that has not been done yet.

onepiecefreak3 commented 3 years ago

So, basically, one can resolve this issue by, for example, adding a window-wide panel on which I handle the drag events. Given that I want drag'n'drop on the whole form. Since this issue seemed to also ignite a future feature to forward the events to the form in some capacity, I will leave this issue open, until closed by @cwensley .