1

My WPF Window uses AvalonDock to arrange different layouts. In one layout I have something similar to FileManager control. Inside FileManager control there is a standard WPF TreeView control. In FileManager control I want to allow users to drag and drop files from Windows explorer. However, when I drag files from explorer to my AvalonDock window it shows me disabled icon - no matter if I go over FileManager control or any other layout in window. Had tried to add AllowDrop on every element in VisualTree (including window, Avalon docking manager, Grids, etc.) When I inspect my window in runtime (with SnoopUI and WPF Inspector) I see that all layouts do have "AllowDrop" set to true!

Here is inspecting window in runtime with Snoop:

enter image description here

It is as my window somehow disables Drag and Drop functionality (from other programs) no matter what I set on controls and templates in AvalonDock layouts.

Is there a way to enable drag and drop of files from other programs in AvalonDock enabled application?

VladacusB
  • 844
  • 1
  • 7
  • 24

2 Answers2

0

nothing to do with avalon...you have to manage the drop event :

private void RibbonWindow_Drop(object sender, DragEventArgs e)

and all drag events enter, leave, over

look at this and this

GCamel
  • 612
  • 4
  • 8
  • Yes, I had added all those events and handlers and it still blocks drag and drop (shows blocking icon when dragging over window for example). – VladacusB Mar 21 '17 at 14:58
  • and you manage the effect in the over event ? private void listViewContent_DragOver(object sender, DragEventArgs e) { if (!e.Data.GetDataPresent("CBR.Book.Path")) { e.Effects = DragDropEffects.None; return; }...also need to manage the drag_start event and the effect – GCamel Mar 21 '17 at 15:25
0

As a matter of fact, problem has nothing to do with AvalonDock and WPF. My application needs to run as administrator. Windows blocks any application running under different user privileges to drag and drop - security feature of Windows...

More info:

Visual Studio 2010 WPF Project ran in debug or relase will not allow drag and drop to any control

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

Community
  • 1
  • 1
VladacusB
  • 844
  • 1
  • 7
  • 24