예제 #1
0
        private void dragDropService_PreviewDragDrop(object sender, RadDropEventArgs e)
        {
            SnapshotDragItem dragInstance = e.DragInstance as SnapshotDragItem;

            if (dragInstance == null)
            {
                return;
            }

            RadItem     dropTarget = e.HitTarget as RadItem;
            RadGridView targetGrid = dropTarget.ElementTree.Control as RadGridView;

            if (targetGrid == null)
            {
                return;
            }

            RadGridView dragGrid = dragInstance.Item.ElementTree.Control as RadGridView;

            if (targetGrid != dragGrid)
            {
                e.Handled = true;

                CustomGridBehavior behavior      = (CustomGridBehavior)dragGrid.GridBehavior;
                GridDataRowElement dropTargetRow = dropTarget as GridDataRowElement;
                int index = dropTargetRow != null?this.GetTargetRowIndex(dropTargetRow, e.DropLocation) : targetGrid.RowCount;

                this.MoveRows(targetGrid, dragGrid, behavior.SelectedRows, index);
            }
        }
예제 #2
0
        private void svc_PreviewDragOver(object sender, RadDragOverEventArgs e)
        {
            SnapshotDragItem dragged = e.DragInstance as SnapshotDragItem;

            if (dragged != null && dragged.Item is GridHeaderCellElement)
            {
                e.CanDrop = e.HitTarget is GroupPanelElement;
            }
        }
예제 #3
0
        private void svc_PreviewDragStart(object sender, PreviewDragStartEventArgs e)
        {
            SnapshotDragItem dragged = e.DragInstance as SnapshotDragItem;

            if (dragged != null && dragged.Item is GridHeaderCellElement)
            {
                e.CanStart = true;
            }
        }
예제 #4
0
        private void dragDropService_PreviewDragHint(object sender, PreviewDragHintEventArgs e)
        {
            SnapshotDragItem dragInstance = e.DragInstance as SnapshotDragItem;

            if (dragInstance == null)
            {
                return;
            }

            GridViewRowInfo rowInfo = e.DragInstance.GetDataContext() as GridViewRowInfo;

            if (rowInfo != null && rowInfo.ViewTemplate.MasterTemplate.SelectedRows.Count > 1)
            {
                e.DragHint       = new Bitmap(this.imageList1.Images[6]);
                e.UseDefaultHint = false;
            }
        }