Ejemplo n.º 1
0
        protected override DropPosition GetDropPosition(DragEventArgs args, RowColumnIndex rowColumnIndex)
        {
            bool             canDrop       = true;
            var              p             = args.GetPosition(this.TreeGrid);
            var              treeNode      = this.TreeGrid.GetNodeAtRowIndex(rowColumnIndex.RowIndex);
            ScrollAxisRegion columnRegion  = ScrollAxisRegion.Body;
            var              treeGridPanel = TreeGrid.GetTreePanel();

            if (treeGridPanel.FrozenColumns > 0)
            {
                columnRegion = ScrollAxisRegion.Header;
            }
            var rowRect = treeGridPanel.RangeToRect(ScrollAxisRegion.Body, columnRegion, rowColumnIndex, true, false);
            var node    = treeNode;

            if (!canDrop)
            {
                return(DropPosition.None);
            }
            else if (p.Y > rowRect.Y + 15 && p.Y < rowRect.Y + 35)
            {
                return(DropPosition.DropAsChild);
            }
            else if (p.Y < rowRect.Y + 15)
            {
                return(DropPosition.DropAbove);
            }
            else if (p.Y > rowRect.Y + 35)
            {
                return(DropPosition.DropBelow);
            }
            else
            {
                return(DropPosition.Default);
            }
        }