private void DragLeave(object sender, DragEventArgs e) { if (sender is FrameworkElement fe) { DropBinding.ClearAdorners(); } }
private void Drop(object sender, DragEventArgs e) { if (sender is FrameworkElement fe) { DropBinding.ClearAdorners(); var draggedItem = e.Data.GetData(instanceType); if (draggedItem == null) { return; } var target = fe.DataContext; if (target == null || !items.Contains(target)) { return; } if (items.Contains(draggedItem)) { items.Remove(draggedItem); } e.Effects = DragDropEffects.Copy; var index = items.IndexOf(target) + (DropTypeByPosition(e, fe) == DropAdornerKind.Bottom ? 1 : 0); items.Insert(index, draggedItem); } }
private void DragOver(object sender, DragEventArgs e) { if (sender is FrameworkElement fe) { DropBinding.ClearAdorners(); if (e.Data.GetData(instanceType) == null) { e.Effects = DragDropEffects.None; e.Handled = true; return; } ; var dropAdornerKind = DropTypeByPosition(e, fe); fe.Adorn(dropAdornerKind); e.Effects = DragDropEffects.Copy; e.Handled = true; } }