diff --git a/GongSolutions.Wpf.DragDrop/DragDrop.cs b/GongSolutions.Wpf.DragDrop/DragDrop.cs index b52dfd85..fcf29fca 100644 --- a/GongSolutions.Wpf.DragDrop/DragDrop.cs +++ b/GongSolutions.Wpf.DragDrop/DragDrop.cs @@ -432,7 +432,7 @@ private static void IsDropTargetChanged(DependencyObject d, DependencyPropertyCh } } - private static void CreateDragAdorner() + private static void CreateDragAdorner(DropInfo dropInfo) { var template = GetDragAdornerTemplate(m_DragInfo.VisualSource); var templateSelector = GetDragAdornerTemplateSelector(m_DragInfo.VisualSource); @@ -499,7 +499,7 @@ private static void CreateDragAdorner() adornment.Opacity = GetDefaultDragAdornerOpacity(m_DragInfo.VisualSource); } - var rootElement = RootElementFinder.FindRoot(m_DragInfo.VisualSource); + var rootElement = RootElementFinder.FindRoot(dropInfo.VisualTarget ?? m_DragInfo.VisualSource); DragAdorner = new DragAdorner(rootElement, adornment); } } @@ -542,7 +542,7 @@ private static void CreateEffectAdorner(DropInfo dropInfo) var template = GetEffectAdornerTemplate(m_DragInfo.VisualSource, dropInfo.Effects, dropInfo.DestinationText); if (template != null) { - var rootElement = RootElementFinder.FindRoot(m_DragInfo.VisualSource); + var rootElement = RootElementFinder.FindRoot(dropInfo.VisualTarget ?? m_DragInfo.VisualSource); var adornment = new ContentPresenter(); adornment.Content = m_DragInfo.Data; @@ -869,7 +869,7 @@ private static void DropTarget_PreviewDragOver(object sender, DragEventArgs e) dropHandler.DragOver(dropInfo); if (DragAdorner == null && m_DragInfo != null) { - CreateDragAdorner(); + CreateDragAdorner(dropInfo); } if (DragAdorner != null) {