Row Reorder Event

2 posts, 2 answers
  1. Answer
    Eric
    Eric avatar
    9 posts
    Member since:
    Sep 2011

    Posted 14 Sep 2012 Link to this post

    Is there any way to catch a row reorder event?

    My grid is in unbound mode, with AllowRowReorder = true.  I need to be able to tell when a user reorders the rows via drag and drop, but the obvious DragDrop event is not hit.  Do I really need to use MouseDown, MouseUp, and lots of calculations of row size and position?


    -----------------------------------------------------------

    Since posting this I found my answer in your demo:

    ...
     this.radGridView1.Rows.CollectionChanged += new NotifyCollectionChangedEventHandler(Rows_CollectionChanged);
    ...

     private void Rows_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
    {
    if (e.Action == NotifyCollectionChangedAction.Move)
    {
    for (int i = 0; i < this.radGridView1.Rows.Count; i++)
    {
    this.radGridView1.Rows[i].Cells["Priority"].Value = i + 1;
    }
    }
    }
  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 07 Nov 2012 Link to this post

    Hello Eric,

    I made a code library project a while back that handles drag drop in bounded mode,

    If you will require anything more complex than your example here, please take a look at that one for inspiration.

    If you have any other questions, please let me know.

    Best Regards,
    Emanuel Varga
    Winforms MVP
Back to Top