When you start dragging and your window isn't the main one, the dragAdorner isn't shown.
Please change CreateDragAdorner into: static void CreateDragAdorner() { DataTemplate template = GetDragAdornerTemplate(m_DragInfo.VisualSource);
if (template != null)
{
UIElement rootElement = null;
// Find the current top window
Window parentWindow =
TryFindParent<Window>(m_DragInfo.VisualSource); if (parentWindow != null) rootElement = parentWindow.Content as UIElement; if (rootElement == null) rootElement = (UIElement)Application.Current.MainWindow.Content; UIElement adornment = null; ....
The TryFindParent method is well documented at http://www.hardcodet.net/2008/02/find-wpf-parent
Good luck,
Frank
Comment #1
Posted on May 4, 2010 by Helpful KangarooThanks for the report and the fix! Patch committed. I didn need TryFindParent - I have my own extension method GetVisualAncestor<> which does the same thing.
Could you check the patch indeed fixes the problem for you?
Comment #2
Posted on May 4, 2010 by Helpful KangarooComment deleted
Comment #3
Posted on May 4, 2010 by Helpful KangarooApplied to trunk in r20.
Comment #4
Posted on May 4, 2010 by Happy HippoOk, I will see it.
When you drag a root to a child you now get grandchildren. I'm yet altering your component to preserve the level in a TreeList (using the classes of the interfaces).
That might be something for the generic Component. A boolean called PreserveLevel that only allows starting a drag when all items have the same level and allow dropping when the target has that same level (or one higher).
Comment #5
Posted on Jul 4, 2010 by Helpful KangarooIssue 23 has been merged into this issue.
Status: Fixed
Labels:
Type-Defect
Priority-Medium