protected override void DragDropMove(object sourceItem, object destinationItem, IList itemList) { TCollection SourceCollection = (TCollection)((TItem)sourceItem).Children; TCollection DestinationCollection = (TCollection)((TItem)destinationItem).Children; if (itemList != null) { foreach (TItem ChildItem in itemList) { SourceCollection.Remove(ChildItem); } foreach (TItem ChildItem in itemList) { ChildItem.ChangeParent((TItem)destinationItem); DestinationCollection.Add(ChildItem); } } DestinationCollection.Sort(); }
/// <summary> /// Moves items from source to destination. /// </summary> /// <param name="sourceItem">The source item.</param> /// <param name="destinationItem">The destination item.</param> /// <param name="itemList">Moved children.</param> protected override void DragDropMove(object sourceItem, object destinationItem, IList itemList) { TItem SourceItem = (TItem)sourceItem; TItem DestinationItem = (TItem)destinationItem; TCollection SourceCollection = (TCollection)SourceItem.Children; TCollection DestinationCollection = (TCollection)DestinationItem.Children; #if NETCOREAPP3_1 foreach (TItem?ChildItem in itemList) { if (ChildItem != null) { SourceCollection.Remove(ChildItem); } } foreach (TItem?ChildItem in itemList) { if (ChildItem != null) { ChildItem.ChangeParent((TItem)destinationItem); DestinationCollection.Add(ChildItem); } } #else foreach (TItem ChildItem in itemList) { SourceCollection.Remove(ChildItem); } foreach (TItem ChildItem in itemList) { ChildItem.ChangeParent((TItem)destinationItem); DestinationCollection.Add(ChildItem); } #endif DestinationCollection.Sort(); }