This is a migrated thread and some comments may be shown as answers.

Drag and drop on MultiSelected rows

3 Answers 199 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paulo Goncalves
Top achievements
Rank 2
Paulo Goncalves asked on 14 Jun 2013, 03:19 PM

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.


3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 19 Jun 2013, 09:22 AM
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?
0
Paulo Goncalves
Top achievements
Rank 2
answered on 20 Jun 2013, 01:40 PM
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
0
Stefan
Telerik team
answered on 25 Jun 2013, 10:47 AM
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?
Tags
GridView
Asked by
Paulo Goncalves
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Paulo Goncalves
Top achievements
Rank 2
Share this question
or