Reputation: 3978
My WPF application inhibits the Drop of files from Windows Explorer, showing a Stop-sign cursor.
I've tried setting the AllowDrop property (that of the UIElement ancestor) to true on the main window and contained controls, but no luck at all, no drag-drop events are fired.
Any ideas or suggestions to find the cause?
Upvotes: 21
Views: 13470
Reputation: 1365
In my case it was running Visual Studio as Administrator on Windows 10. The UAC prevented the drag/drop. When I ran VS without elevating drag/drop started working in debug mode.
Upvotes: 20
Reputation: 665
According to this: http://codeinreview.com/136/enabling-drag-and-drop-over-a-grid-in-wpf/ (Which I am happy to report works!)
All you need to do is add a background on the control that has to get the drop. This will enable hit testing and thus make the drop-feature work.
Note: The background can be transparent, you just have to set it.
Upvotes: 8
Reputation: 3978
Solved!
The problem was that executing my app thru VisualStudio (run/debug) prevented the interop with Windows' drag & drop mechanism. Running the App as stand-alone makes it work, but cannot debug interactively.
This answer helped a lot: Visual Studio 2010 WPF Project ran in debug or relase will not allow drag and drop to any control
Upvotes: 26