Пример #1
0
        /// <summary>
        /// Copy items from source to destination.
        /// </summary>
        /// <param name="sourceItem">The source item.</param>
        /// <param name="destinationItem">The destination item.</param>
        /// <param name="itemList">Children at the source.</param>
        /// <param name="cloneList">Cloned children at the destination.</param>
        protected override void DragDropCopy(object sourceItem, object destinationItem, IList itemList, IList cloneList)
        {
            Debug.Assert(itemList.Count > 0);

            TItem       DestinationItem       = (TItem)destinationItem;
            TCollection DestinationCollection = (TCollection)DestinationItem.Children;

#if NETCOREAPP3_1
            foreach (ICloneable?ChildItem in itemList)
            {
                if (ChildItem != null)
                {
                    TItem Clone = (TItem)ChildItem.Clone();
                    Clone.ChangeParent(DestinationItem);
                    DestinationCollection.Add(Clone);

                    cloneList.Add(Clone);
                }
            }
#else
            foreach (ICloneable ChildItem in itemList)
            {
                TItem Clone = (TItem)ChildItem.Clone();
                Clone.ChangeParent(DestinationItem);
                DestinationCollection.Add(Clone);

                cloneList.Add(Clone);
            }
#endif

            DestinationCollection.Sort();
        }
Пример #2
0
        protected override void DragDropCopy(object sourceItem, object destinationItem, IList itemList, IList cloneList)
        {
            TCollection DestinationCollection = (TCollection)((TItem)destinationItem).Children;

            if (itemList != null && cloneList != null)
            {
                foreach (ICloneable ChildItem in itemList)
                {
                    TItem Clone = (TItem)ChildItem.Clone();
                    Clone.ChangeParent((TItem)destinationItem);
                    DestinationCollection.Add(Clone);

                    cloneList.Add(Clone);
                }
            }

            DestinationCollection.Sort();
        }