/// <summary> /// true if can drop item from selected toolbox item /// </summary> /// <returns></returns> public bool CanDropFromSelectedToolboxItem(DragEventArgs de, bool isOnTable) { bool canDrop = true; ToolboxItem toolboxItem = GetToolboxItem(de) ?? SelectedToolboxItem; if (toolboxItem != null) { IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); Type type; CanParentArgs canParentArgs; if (toolboxItem is ICanParentArgsProvider) { canParentArgs = ((ICanParentArgsProvider)toolboxItem).GetCanParentArgs(host, isOnTable, DragOperationType.Drop); } else { type = toolboxItem.GetType(host); canParentArgs = new CanParentArgs(type, null, DragOperationType.Drop); } if (canParentArgs.ChildControlType != null) { canDrop = CanParent(canParentArgs); } else { canDrop = false; } } return(canDrop); }
public bool CanParent(CanParentArgs canParentArgs) { if (container != null) { return(container.CanParent(canParentArgs)); } else { return(true); } }