Ejemplo n.º 1
0
        protected override void ProcessDragDrop(Point dropLocation, ISupportDrag dragObject)
        {
            GroupFieldDragDropContext dataContext1 = dragObject.GetDataContext() as GroupFieldDragDropContext;

            if (dataContext1 != null)
            {
                dataContext1.ViewTemplate.GroupDescriptors.Remove(dataContext1.GroupDescription);
            }
            else
            {
                GridViewRowInfo dataContext2 = dragObject.GetDataContext() as GridViewRowInfo;
                if (dataContext2 != null)
                {
                    if (this.RowInfo.ViewTemplate.SortDescriptors.Count > 0 || this.RowInfo.ViewTemplate.GroupDescriptors.Count > 0)
                    {
                        return;
                    }
                    bool             isDroppedAtLeft = RadGridViewDragDropService.IsDroppedAtTop(dropLocation, this.Size.Height);
                    GridViewTemplate viewTemplate    = this.Data.ViewTemplate;
                    int targetIndex      = viewTemplate.Rows.IndexOf(this.Data);
                    int draggedItemIndex = viewTemplate.Rows.IndexOf(dataContext2);
                    RadGridViewDragDropService.CalculateTargetIndex(isDroppedAtLeft, viewTemplate.RowCount, ref targetIndex, ref draggedItemIndex);
                    viewTemplate.Rows.Move(draggedItemIndex, targetIndex);
                }
                else
                {
                    base.ProcessDragDrop(dropLocation, dragObject);
                }
            }
        }
Ejemplo n.º 2
0
        public override Point GetDragHintLocation(ISupportDrop dropTarget, Point mousePosition)
        {
            GridRowElement gridRowElement = dropTarget as GridRowElement;
            Rectangle      screen         = this.GridViewElement.ElementTree.Control.RectangleToScreen(gridRowElement.ControlBoundingRectangle);
            Size           size           = this.DragHint.Image.Size;
            Padding        margins        = this.DragHint.Margins;
            int            num            = RadGridViewDragDropService.IsDroppedAtTop(gridRowElement.PointFromScreen(mousePosition), gridRowElement.Size.Height) ? screen.Y : screen.Bottom;

            return(new Point(screen.X - margins.Left, num - size.Height / 2));
        }