11 public class DropAllowedHandler : DefaultDropHandler
15 private static readonly DropAllowedHandler instance =
new DropAllowedHandler();
18 static DropAllowedHandler()
22 private DropAllowedHandler()
29 public static DropAllowedHandler
Instance => instance;
42 public override void DragOver(IDropInfo dropInfo)
44 dropInfo.DropTargetHintAdorner = DropTargetAdorners.Hint;
46 if (dropAllowed(dropInfo))
48 dropInfo.DropTargetHintState = DropHintState.Active;
49 dropInfo.DropTargetAdorner = DropTargetAdorners.Insert;
50 dropInfo.Effects = DragDropEffects.Move;
54 dropInfo.DropTargetHintState = DropHintState.Error;
56 dropInfo.Effects = DragDropEffects.None;
61 public override void Drop(IDropInfo dropInfo)
63 if (dropAllowed(dropInfo))
70 private bool dropAllowed(IDropInfo dropInfo)
72 ICollection sourceCollection = dropInfo.DragInfo.SourceCollection as ICollection;
73 ICollection targetCollection = dropInfo.TargetCollection as ICollection;
78 bool dropAllowed = (targetCollection == sourceCollection ||
80 if (!CanAcceptData(dropInfo))
84 else if (dragItem !=
null && dropItem !=
null)
87 dragItem.Style == dropItem.Style &&
90 else if (dragItem !=
null && dropItem ==
null && targetCollection.Count == 0)
94 else if (dragItem !=
null && dropItem ==
null && targetCollection.Count > 0)
96 PersonStart firstStart = (targetCollection as IList)?.Cast<PersonStart>().FirstOrDefault();
99 dragItem.Style == firstStart?.Style &&