Drag and drop on MultiSelected rows

4 posts, 0 answers
  1. Paulo Goncalves
    Paulo Goncalves avatar
    26 posts
    Member since:
    Aug 2004

    Posted 14 Jun 2013 Link to this post


    I have a scenario with two RagGridView, I need select 5 rows at RadGridView1 to drop at RadGridView2.

    1 - Selected the 5 rows and release the button.
    2 - Now I was press the left button again at one these 5 selected row to make the drag. At this moment all the rows was unselect. 

    This is a different behavior from Windows Explorer and the comon multiselect lists.


  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 19 Jun 2013 Link to this post

    Hello Paulo,

    Thank you for writing.

    To prevent the deselection you should use a custom row behavior. Attached you can find a sample demonstrating how you can achieve this. Please have a look at it and let me know if you have any additional questions.

    I hope this helps.
     

    Regards,
    Stefan
    Telerik
    RadChart for WinForms is obsolete. Now what?
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Paulo Goncalves
    Paulo Goncalves avatar
    26 posts
    Member since:
    Aug 2004

    Posted 20 Jun 2013 Link to this post

    Hi Stefan,

    thanks for your help, I make a little bit modification, when release the button at selected row and the control key was pressed, the row is deselected. I use OnMouseUpLeft and a private flag at behavior Class.

    class MyGridNavigator : GridDataRowBehavior
       {
           private bool RowSelectedNow;
     
           protected override bool OnMouseDownLeft(MouseEventArgs e)
           {
               RowSelectedNow = false;
               GridRowElement row = this.GetRowAtPoint(e.Location) as GridRowElement;
               if (row != null)
               {
                   if (row.RowInfo.IsSelected) {return false;}
                   if (Control.ModifierKeys == Keys.Control) {RowSelectedNow = true;}
               }
               return base.OnMouseDownLeft(e);
           }
     
           protected override bool OnMouseUpLeft(MouseEventArgs e)
           {
               GridRowElement row = this.GetRowAtPoint(e.Location) as GridRowElement;
               if (row != null)
               {
                   if (Control.ModifierKeys == Keys.Control && RowSelectedNow == false)
                   {
                       row.RowInfo.IsSelected = !row.RowInfo.IsSelected;
                       return false;
                   }
               }
               return base.OnMouseUpLeft(e);
           }
     
       }


    I have other doubt, I only Drag if the .AllowRowReorder=True at source RadGrid, but I don´t like reorder the source, How I supress ou disable the reorder event


    Thanks

    Paulo
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 25 Jun 2013 Link to this post

    Hello Paulo,

    To do that you would have to start the drag drop service in the grid manually. Here is a blog describing the whole process: http://blogs.telerik.com/careypayette/posts/13-05-15/extending-radgridview-to-enable-row-drag-and-drop-functionality.

    Let us know if you have any other questions.
     
    Regards,
    Stefan
    Telerik
    RadChart for WinForms is obsolete. Now what?
Back to Top