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

The WPF application prevents the deletion of files from Windows Explorer by displaying the Stop-sign cursor.

I tried to set the AllowDrop property (ancestor of UIElement) to true in the main window and contained controls, but no luck at all, no drag and drop events are fired.

Any ideas or suggestions to find a reason?

+9
source share
3 answers

Solved!

The problem was that running my application through VisualStudio (run / debug) prevented the interaction with the Windows drag and drop mechanism. Running the application offline makes it work, but cannot debug it interactively.

This answer helped a lot: The WPF Visual Studio 2010 project, launched when debugging or remaking, will not allow you to drag and drop any control

+14
source

In my case, it was running Visual Studio as an administrator on Windows 10. UAC prevented drag and drop. When I started VS without increasing the drag level I started working in debug mode.

+2
source

According to this: http://codeinreview.com/136/enabling-drag-and-drop-over-a-grid-in-wpf/ (What I'm glad to report on the work!)

All you have to do is add a background to the control, which should get a drop. This will allow testing for impact and, thus, do work with the frame.

Note. The background may be transparent, you just need to set it.

+1
source

Source: https://habr.com/ru/post/950940/


All Articles