Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1170
Auto scroll rows, while dragging rows in ultragrid.
posted

I have an ultragrid, in which user can re-arrange the index of rows by dragging and dropping. Suppose there are 50 rows, but only 20 rows are in the visible region. Now, I want to have a functionality that if user wants to drag row #1 to just above row #40, then as soon as he reaches the end of the visible region, the grid should scroll down automatically.

Parents
No Data
Reply
  • 21795
    Verified Answer
    Offline posted

    Hello Sumit,

    Thank you for contacting Infragistics Developers Support.

    To scroll the grid while performing drag and drop operation you need to check in DragOver event if the mouse pointer is reach the grid’s active scroll region top or bottom. If so force the grid to scroll up or down. You can use code like this in your DragOver event handler:

    Point point = grid.PointToClient(new Point(e.X, e.Y));

    if (point.Y < 20)

    {

    // Scroll up.

    this.ultraGrid1.ActiveRowScrollRegion.Scroll(RowScrollAction.LineUp);

    }

    else if (point.Y > grid.Height - 20)

    {

    // Scroll down.

    this.ultraGrid1.ActiveRowScrollRegion.Scroll(RowScrollAction.LineDown);

    }

    Please find attached a small sample solution implementing this approach.

    Please let me know if you need any further assistance.

    CAS-149115-L6X9C2.zip
Children