DropTarget doesnt work in ChildWindow

Oct 15, 2009 at 1:01 PM
Edited Oct 15, 2009 at 1:02 PM

I am having a problem getting the Drag and Drop working in a ChildWindow.

I have set up and example almost identical to the ListBox demo in the example app the only difference being its in a ChildWindow instead of a UserControl.

The dragging functionality is working, however no DropTargets seem to be available.  I have tried using a UserControl inside a ChildWindow as well but still no luck.

I am running on SL 3.

Is this a known issue and if so any fixes/workarounds as its quite a big bug?

Coordinator
Oct 16, 2009 at 11:13 AM

As a reference, I'm going to add what I replied to the topic starter by mail - in case anyone else runs into the same problem :-)

 

"Hello,

I checked this, and I’m afraid you’ve run into a bit of a problem: the SL 3 ChildWindow is not part of the main Visual Tree, and because of that, the Drag Drop Manager doesn’t recognize the DropTargets: the Drag Drop Manager looks for valid DropTargets in the Visual Tree.

 

What *might* work (though I’m not sure of this): if you’re specifying the DropTargets in code, the Drag Drop Manager checks for that droptarget instead of running through the visual tree to find ‘em.  So specifically doing this instead of using the AllowAnyDropTarget-property might work.

 

What *will* work is using an element that’s in the Visual Tree for the modal popup (childwindow).  This means: not using the child window control, but show a panel that’s part of the visual tree over your other controls when needed.  However, I do not know if that’s possible in your specific situation.

 

Another option would require changing the sourcecode: in the check for a valid DropTarget, you can write code which will also check the “underlying” Visual Tree.

 

I hope one of these possible options works for you.  I will surely consider this behaviour for the next version of the Drag Drop Manager."