public void RegisterDropTarget(IDropTarget dropTarget) { if (!DropTargets.Contains(dropTarget)) { DropTargets.Add(dropTarget); } }
public void RemoveDropTarget(IDropTarget dropTarget) { if (!DropTargets.Contains(dropTarget)) { throw new Exception("Элемент не найден"); } DropTargets.Remove(dropTarget); }
public void RegisterDropTarget(IDropTarget dropTarget, params string[] allowedDropGroupNames) { if (!DropTargets.Contains(dropTarget)) { DropTargets.Add(dropTarget); } foreach (var item in allowedDropGroupNames) { dropTarget.AllowedDropGroupNames.Add(item); } }
private IDropTarget FindParentAllowedTarget(IDropTarget dropTarget) { DependencyObject parent = dropTarget.Instanse.Parent; while (parent != null) { var parentDropTarget = parent as IDropTarget; if ((parentDropTarget != null) && DropTargets.Contains(parentDropTarget) && IsAcceptableTarget(parentDropTarget)) { return(parentDropTarget); } parent = VisualTreeHelper.GetParent(parent); } return(null); }