protected override void ProcessDragDrop(Point dropLocation, ISupportDrag dragObject)
        {
            object      dataContext  = dragObject.GetDataContext();
            RadPosition dropPosition = RadGridViewDragDropService.GetDropPosition(dropLocation, this.Size);
            ColumnGroupsViewDefinition viewDefinition = this.ViewTemplate.ViewDefinition as ColumnGroupsViewDefinition;

            if (viewDefinition != null)
            {
                if (dataContext is GridViewColumnGroup)
                {
                    ((GridViewColumnGroup)dataContext).IsVisible = true;
                    this.TableElement.UpdateLayout();
                    if (!this.ViewTemplate.AllowColumnReorder)
                    {
                        return;
                    }
                    this.DropColumnGroup(viewDefinition, (GridViewColumnGroup)dataContext, dropPosition);
                    return;
                }
                if (dataContext is GridViewDataColumn || dataContext is GridViewGroupColumn)
                {
                    this.DropInColumnGroupsView(viewDefinition, dataContext as GridViewColumn, dropPosition);
                    return;
                }
            }
            base.ProcessDragDrop(dropLocation, dragObject);
        }
        public override void UpdateDropContext(
            ISupportDrag draggedContext,
            ISupportDrop dropTarget,
            Point?location)
        {
            GridColumnGroupCellElement groupCellElement    = dropTarget as GridColumnGroupCellElement;
            GridHeaderCellElement      headerCellElement   = dropTarget as GridHeaderCellElement;
            GridViewGroupColumn        gridViewGroupColumn = groupCellElement != null ? groupCellElement.ColumnInfo as GridViewGroupColumn : (GridViewGroupColumn)null;

            if (headerCellElement == null || !location.HasValue)
            {
                this.orientation = Orientation.Vertical;
            }
            else
            {
                if (headerCellElement.RowElement == null || headerCellElement.RowElement.TableElement == null)
                {
                    return;
                }
                Rectangle boundingRectangle1 = headerCellElement.ControlBoundingRectangle;
                Rectangle boundingRectangle2 = headerCellElement.RowElement.TableElement.ViewElement.ControlBoundingRectangle;
                if (boundingRectangle1.Right > boundingRectangle2.Right)
                {
                    boundingRectangle1.Width -= boundingRectangle1.Right - boundingRectangle2.Right;
                }
                if (boundingRectangle1.X < boundingRectangle2.X)
                {
                    boundingRectangle1.Width -= boundingRectangle2.X - boundingRectangle1.X;
                    boundingRectangle1.X      = boundingRectangle2.X;
                }
                if ((RadGridViewDragDropService.GetDropPosition(headerCellElement.PointFromScreen(location.Value), headerCellElement.Size) & RadPosition.Bottom) != RadPosition.None && (gridViewGroupColumn != null && gridViewGroupColumn.Group.Rows.Count == 0 && draggedContext.GetDataContext() is GridViewGroupColumn || gridViewGroupColumn != null && gridViewGroupColumn.Group.Groups.Count == 0 && draggedContext.GetDataContext() is GridViewDataColumn || gridViewGroupColumn == null))
                {
                    this.orientation = Orientation.Horizontal;
                }
                else
                {
                    this.orientation = Orientation.Vertical;
                }
            }
        }
Ejemplo n.º 3
0
        protected override void HandleMouseMove(Point mousePosition)
        {
            ISupportDrop dropTarget = this.DropTarget;

            this.AutoScroll();
            base.HandleMouseMove(mousePosition);
            RadElement  radElement  = dropTarget as RadElement;
            RadPosition radPosition = RadPosition.None;

            if (radElement != null)
            {
                radPosition = RadGridViewDragDropService.GetDropPosition(radElement.PointFromScreen(mousePosition), radElement.ControlBoundingRectangle.Size);
            }
            if (dropTarget != this.DropTarget || dropTarget == null || radPosition != this.lastDropPosition)
            {
                this.SetDragDropBehavior();
            }
            this.lastDropPosition = radPosition;
            if (this.dragHintWindow == null)
            {
                return;
            }
            this.UpdateDragHintLocation(mousePosition);
        }