Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why my WPF application has Drag & Drop disabled (even when AllowDrop is true)?

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?

like image 617
Néstor Sánchez A. Avatar asked Aug 03 '13 03:08

Néstor Sánchez A.


2 Answers

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

like image 175
Néstor Sánchez A. Avatar answered Oct 08 '22 13:10

Néstor Sánchez A.


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.

like image 34
stambikk Avatar answered Oct 08 '22 12:10

stambikk