How can I allow Drag and Drop from Windows Explorer into a C# WPF application? How can I allow Drag and Drop from Windows Explorer into a C# WPF application? wpf wpf

How can I allow Drag and Drop from Windows Explorer into a C# WPF application?


I've solved my problem I believe. I was running Visual Studio as Administrator. When it launched my application, it didn't recognize drags from Explorer because Explorer was running in User mode. Hope this bonehead move helps someone else out.


AllowDrop only activates the possibility to use drag & drop.You have to handle it yourself.

As you have seen, Objects that have AllowDrop also have the events DragEnter, DragOver, DragLeave.You have to code what you want to happen at this moments.You can change cursor, accept dropped items, etc.But you have to do it your own. E.g. look for DragEventArgs.Effects.

I just opened a new WPF app, selected window, enabled AllowDrop, added event handler DragEnter and put in there: e.Effects = DragDropEffects.Move;Works fine for me.