37 public override void DragOver(IDropInfo dropInfo)
39 dropInfo.DropTargetHintAdorner = DropTargetAdorners.Hint;
43 dropInfo.DropTargetHintState = DropHintState.Active;
44 dropInfo.DropTargetAdorner = DropTargetAdorners.Insert;
45 dropInfo.Effects = DragDropEffects.Move;
49 dropInfo.DropTargetHintState = DropHintState.Error;
50 dropInfo.DropHintText =
"";
51 dropInfo.Effects = DragDropEffects.None;
79 if (dropInfo?.DragInfo ==
null)
84 int insertIndex = GetInsertIndex(dropInfo);
85 IList destinationList = dropInfo.TargetCollection.TryGetList();
86 List<object> data = ExtractData(dropInfo.Data).OfType<
object>().ToList();
88 if(data.FirstOrDefault().GetType() != typeof(
Race))
93 bool isSameCollection =
false;
94 IList sourceList = dropInfo.DragInfo.SourceCollection.TryGetList();
95 if (sourceList !=
null)
97 isSameCollection = sourceList.IsSameObservableCollection(destinationList);
98 if (!isSameCollection)
100 foreach (
object o
in data)
102 int index = sourceList.IndexOf(o);
105 sourceList.RemoveAt(index);
108 if (destinationList !=
null && ReferenceEquals(sourceList, destinationList) && index < insertIndex)
117 if (destinationList !=
null)
119 List<object> objects2Insert =
new List<object>();
121 if(data.FirstOrDefault().GetType() == typeof(
Race))
123 List<PersonStart> persons =
new List<PersonStart>();
124 data.Cast<
Race>().ToList().ForEach(r => persons.AddRange(r.Starts));
125 data = persons.Cast<
object>().ToList();
128 foreach (
object o
in data)
130 object obj2Insert = o;
132 objects2Insert.Add(obj2Insert);
134 if (isSameCollection)
136 int index = destinationList.IndexOf(o);
139 if (insertIndex > index)
144 Move(destinationList, index, insertIndex++);
149 destinationList.Insert(insertIndex++, obj2Insert);
152 if (obj2Insert is IDragItemSource dragItemSource)
154 dragItemSource.ItemDropped(dropInfo);
158 SelectDroppedItems(dropInfo, objects2Insert);