I use adorner to show the "ghost" of an element that is being dragged ...
var adornerLayer = AdornerLayer.GetAdornerLayer(topLevelGrid);
dragAdorner = new DragAdorner(topLevelGrid, itemToDrag);
adornerLayer.Add(dragAdorner);
dragAdorner.UpdatePosition(e.GetPosition(topLevelGrid));
DragDrop.DoDragDrop(sourceItems, viewModel, DragDropEffects.Move);
adornerLayer.Remove(dragAdorner);
itemToDrag = null;
... but I cannot find a good way to update the position of adorner while dragging. The closest I have is to set AllowDrop="true"up a top-level grid and give it a DragOver handler ...
private void TopLevelGrid_OnDragOver(object sender, DragEventArgs e)
{
dragAdorner.UpdatePosition(e.GetPosition(topLevelGrid));
}
But this means that I am not getting the correct feedback DragDropEffectson the cursor, i.e. always shows the cursor DragDropEffects.Moveinstead DragDropEffects.None, until I go to the actual target camera.
Does anyone know how best to update adorner's position?
source
share