protected virtual void OnDragServiceDragOver(object sender, RadDragOverEventArgs e)
 {
     if (e.HitTarget is DraggableLayoutControlItem)
     {
         e.CanDrop = true;
         LayoutControlContainerElement ancestor       = ((DraggableLayoutControlItem)e.HitTarget).AssociatedItem.FindAncestor <LayoutControlContainerElement>();
         LayoutControlDropTargetInfo   dropTargetNode = ancestor.LayoutTree.GetDropTargetNode(e.HitTarget as DraggableLayoutControlItem, this.layoutControl.PointToClient(Control.MousePosition), this.GetDragContext(e.DragInstance));
         dropTargetNode?.TargetBounds.Offset(ancestor.ControlBoundingRectangle.Location);
         this.layoutControl.DragOverlay.SetPreviewRectangle(dropTargetNode != null ? dropTargetNode.TargetBounds : Rectangle.Empty);
     }
     else if (e.HitTarget is DraggableLayoutControlOverlayElement)
     {
         DraggableLayoutControlOverlayElement hitTarget = e.HitTarget as DraggableLayoutControlOverlayElement;
         if (hitTarget.Parent is RootRadElement && hitTarget.Items.Count == 0)
         {
             e.CanDrop = true;
             this.layoutControl.DragOverlay.SetPreviewRectangle(new Rectangle(Point.Empty, this.layoutControl.Size));
         }
         else
         {
             e.CanDrop = false;
         }
     }
     else
     {
         e.CanDrop = false;
         this.layoutControl.DragOverlay.SetPreviewRectangle(Rectangle.Empty);
     }
 }
        public IEnumerable <DraggableLayoutControlItem> GetItems(
            DraggableLayoutControlOverlayElement overlayElement)
        {
            overlayElement = overlayElement ?? this.overlayElement;
            foreach (DraggableLayoutControlItem layoutControlItem1 in (RadItemCollection)overlayElement.Items)
            {
                yield return(layoutControlItem1);

                if (layoutControlItem1.GroupContainer != null)
                {
                    foreach (DraggableLayoutControlItem layoutControlItem2 in this.GetItems(layoutControlItem1.GroupContainer))
                    {
                        yield return(layoutControlItem2);
                    }
                }
                if (layoutControlItem1.ChildItem != null)
                {
                    yield return(layoutControlItem1.ChildItem);

                    foreach (DraggableLayoutControlItem layoutControlItem2 in this.GetItems(layoutControlItem1.ChildItem.GroupContainer))
                    {
                        yield return(layoutControlItem2);
                    }
                }
            }
        }
 protected override void CreateChildItems(RadElement parent)
 {
     base.CreateChildItems(parent);
     this.overlayElement          = new DraggableLayoutControlOverlayElement();
     this.overlayElement.AutoSize = false;
     this.overlayElement.ShouldHandleMouseInput = true;
     parent.Children.Add((RadElement)this.overlayElement);
 }
 private void InitializeChildContainer(LayoutControlGroupItem groupItem)
 {
     this.groupContainer = new DraggableLayoutControlOverlayElement();
     if (groupItem.ContainerElement.Visibility != ElementVisibility.Visible)
     {
         return;
     }
     this.groupContainer.AutoSize = false;
     this.groupContainer.Bounds   = groupItem.ContainerElement.BoundingRectangle;
     this.Children.Add((RadElement)this.groupContainer);
     foreach (LayoutControlItemBase layoutControlItemBase in groupItem.Items)
     {
         this.groupContainer.Items.Add((RadItem) new DraggableLayoutControlItem()
         {
             AssociatedItem = layoutControlItemBase
         });
     }
 }
        protected virtual void OnDragServiceDragDrop(object sender, RadDropEventArgs e)
        {
            e.Handled = true;
            this.layoutControl.DragOverlay.SetPreviewRectangle(Rectangle.Empty);
            DraggableLayoutControlItem           hitTarget1 = e.HitTarget as DraggableLayoutControlItem;
            DraggableLayoutControlOverlayElement hitTarget2 = e.HitTarget as DraggableLayoutControlOverlayElement;
            BaseListViewVisualItem dragInstance             = e.DragInstance as BaseListViewVisualItem;

            if (hitTarget2 != null)
            {
                this.HandleDropOnEmptyContainer(hitTarget2, dragInstance);
            }
            else
            {
                if (hitTarget1 == null)
                {
                    return;
                }
                this.HandleItemDrop(dragInstance, hitTarget1);
            }
        }
        protected virtual void HandleDropOnEmptyContainer(
            DraggableLayoutControlOverlayElement overlayElement,
            BaseListViewVisualItem draggedItem)
        {
            LayoutControlDraggableOverlay control = overlayElement.ElementTree.Control as LayoutControlDraggableOverlay;
            LayoutControlItemBase         layoutControlItemBase;

            if (draggedItem.Data.Group == this.hiddenItemsGroup)
            {
                LayoutControlItemBase tag = draggedItem.Data.Tag as LayoutControlItemBase;
                if (tag == null)
                {
                    return;
                }
                this.layoutControl.HiddenItems.Remove((RadItem)tag);
                layoutControlItemBase = tag;
            }
            else
            {
                layoutControlItemBase = this.CreateNewItem(draggedItem);
            }
            control.Owner.Items.Add((RadItem)layoutControlItemBase);
            control.Owner.ContainerElement.RebuildLayoutTree();
        }