To reproduce: please open the attached sample project and follow the steps illustrated in the attached gif file.
Workaround:
1. You still can scroll while dragging a row by using the mouse wheel.
2. Use the grid in unbound mode and set the AllowRowReorder property to true instead of using a custom RadDragDropService.
3. Use a custom drag and drop service:
public class CustomDragDropService : RadGridViewDragDropService
{
public CustomDragDropService(RadGridViewElement gridViewElement) : base(gridViewElement)
{
}
public override string Name
{
get
{
return typeof(RadGridViewDragDropService).Name;
}
}
protected override void HandleMouseMove(System.Drawing.Point mousePosition)
{
base.HandleMouseMove(mousePosition);
System.Drawing.Point location = this.GridViewElement.ElementTree.Control.PointToClient(Control.MousePosition);
GridTableElement tableElement = this.GetTableElementAtPoint(location);
ISupportDrag supportDrag = this.Context as ISupportDrag;
object dataContext = supportDrag.GetDataContext();
if (this.AllowAutoScrollRowsWhileDragging && dataContext == null)
{
ScrollRows(tableElement, location);
}
}
private void ScrollRows(GridTableElement tableElement, System.Drawing.Point location)
{
ScrollableRowsContainerElement scrollableRows = tableElement.ViewElement.ScrollableRows;
RadScrollBarElement vScrollbar = GetVeritcalScrollbar(tableElement);
System.Drawing.Rectangle containerBounds = scrollableRows.ControlBoundingRectangle;
if (containerBounds.Contains(location) ||
location.X < containerBounds.X ||
location.X > containerBounds.Right)
{
return;
}
int delta = 0;
if (location.Y > containerBounds.Bottom)
{
delta = location.Y - containerBounds.Bottom;
}
else if (location.Y < containerBounds.Y)
{
delta = location.Y - containerBounds.Y;
}
if (delta != 0 && vScrollbar.Visibility == ElementVisibility.Visible)
{
vScrollbar.Value = ClampValue(vScrollbar.Value + delta,
vScrollbar.Minimum,
vScrollbar.Maximum - vScrollbar.LargeChange + 1);
}
}
private int ClampValue(int value, int minimum, int maximum)
{
if (value < minimum)
{
return minimum;
}
if (maximum > 0 && value > maximum)
{
return maximum;
}
return value;
}
private RadScrollBarElement GetVeritcalScrollbar(GridTableElement tableElement)
{
if (GridViewElement.UseScrollbarsInHierarchy)
{
return tableElement.VScrollBar;
}
return GridViewElement.TableElement.VScrollBar;
}
}
public RadForm1()
{
InitializeComponent();
CustomDragDropService customService = new CustomDragDropService(radGridView1.GridViewElement);
radGridView1.GridViewElement.RegisterService(customService);
}