public static int RemoveAllItems(DragDropTarget target, bool sendCallback = true) { var items = target.GetAllAttachedItems(); DragDropEventData eventData = new DragDropEventData(!sendCallback); eventData.Reset(); eventData.target = target; for (int count = items.Count, i = count - 1; i >= 0; --i) { DragDropItem item = items[i]; eventData.item = item; target.OnItemDetach(eventData); item.OnItemDetach(eventData); item.OnSetFree(eventData); } return(items.Count); }
public static int RemoveAllItems(DragDropTarget target) { var items = target.GetAllAttachedItems(); DragDropEventData eventData = new DragDropEventData(); eventData.Reset(); eventData.external = true; eventData.target = target; foreach (var item in items) { eventData.item = item; target.OnItemDetach(eventData); item.OnItemDetach(eventData); target.OnItemExit(eventData); item.OnItemExit(eventData); item.OnSetFree(eventData); } return(items.Length); }