private static void Handle_Drop(object sender, DragEventArgs e) { _layer.Remove(_adorner); _adorner = null; if (Reordered != null) Reordered(_listbox, new DropData { OriginalData = ((ListBoxItem)(sender)).DataContext, DroppedData = e.Data }); }
private static void StartDrag(FrameworkElement draggedItem) { ResetAdorner(); _adorner = new DragAdorner(draggedItem); _layer = AdornerLayer.GetAdornerLayer(_listbox); _layer.Add(_adorner); //blocking call DragDrop.DoDragDrop(draggedItem, draggedItem.DataContext, DragDropEffects.Move); ResetAdorner(); }
private static void ResetAdorner() { if (_adorner != null) { _layer.Remove(_adorner); _adorner = null; } }