We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Drag&Drop with Multiselection

Dear Syncfusion Support Team,

I added to the GridDataControl the ability to Drag and Drop the selected elements.                               

The problem is, if i select more than one elemt in the grid and then I drag the elements, only the draged element is selected and the other ones are deselected.

I think this depends one the event to select an element in the DataGrid. The selection changes if the left mouse button was pressed, in my case the selection should change if the left mouse button wsa clicked.

Is it possible to change the event for selecting an element in the DataGrid?

I attached a short Video and Code example.

Best regards,

Michael



DragAndDropPrototype_c9a06539.zip

3 Replies

RG Rajasekar G Syncfusion Team July 17, 2012 09:37 AM UTC

 

Hi Kramer,

 

Thank you for your update.

 

You can achieve your requirement by using the below code snippet,

 

Code Snippet[C#]:

 

       

DragGrid.Model.SelectionChanging += new GridSelectionChangingEventHandler(Model_SelectionChanging);

 

        void Model_SelectionChanging(object sender, GridSelectionChangingEventArgs e)

        {

            if (e.Reason == GridSelectionReason.MouseDown && (sender as GridDataTableModel).SelectedRanges.AnyRangeContains(e.ClickRange))

            {

                e.Cancel = true;

            }

        }

 

 

 

Please find the modified sample in the below location,

 

Sample: ModifiedSample.zip

 

Please let us know if you have any queries.

 

Thanks,

Raja sekar .G



MK Michael Krämer July 17, 2012 04:25 PM UTC

Hello Mr. Rajasekar,
thank you for the quick response. For now the Problem is solved. But with this fix a new Problem occurs instead, if I want to select one element in the range of selected elements, it is not possible. So i have to select one element outside of the range and then i can select the one which was in the range of the selected elements.

Regards
Michael


RG Rajasekar G Syncfusion Team August 1, 2012 11:29 PM UTC

Hi Kramer,

 

Thanks for the patience.

 

We have analyzed your query and we have modified the sample based as per your requirement and it can be download from the following location.

 

Sample Location: Sample.zip

 

Note: In this case if you start drag the SelectedRange by using mouse  click along with ctrl key the selected range will appear correctly

 

Thanks,

Raja sekar.G


Loader.
Live Chat Icon For mobile
Up arrow icon