Example #1
0
 public bool CanParent(CanParentArgs allowDragDropArgs)
 {
     if (CanParentEvent != null)
     {
         return(CanParentEvent(this, allowDragDropArgs));
     }
     return(true);
 }
Example #2
0
        /// <summary>
        /// Can a control be reparented
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="allowDragDropArgs"></param>
        /// <returns></returns>
        static internal bool CanParent(object sender, CanParentArgs allowDragDropArgs)
        {
            // if it is in the same container - allow
            if (allowDragDropArgs.ChildControl.Parent == sender)
            {
                return(true);
            }

            // if it is in the same tab control - allow
            if (allowDragDropArgs.ChildControl.Parent.Parent is MgTabPage && sender is MgTabPage &&
                allowDragDropArgs.ChildControl.Parent.Parent.Parent == ((Control)sender).Parent)
            {
                return(true);
            }

            // else - deny
            return(false);
        }