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

Drag and Drop with Multiple selection

5 Answers 298 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Audrey
Top achievements
Rank 1
Audrey asked on 14 Jan 2011, 09:39 AM
Hi,

I used a Listbox with a WrapPanel in an ItemsPanelTemplate, like this :

<ListBox x:Name="ProgrammingBox" SelectionMode="Extended">
      <ListBox.ItemsPanel>
               <ItemsPanelTemplate>
                    <toolkit:WrapPanel  />
              </ItemsPanelTemplate>
       </ListBox.ItemsPanel>
</ListBox>

I used the RadDragAndDropManager.

And I want to Drag and Drop multiple items into my Listbox to reorder them. I use the Shift key to select them, but I must stay clicked on my selection to Drag and Drop it. Is it a normal behavior ? Is there a solution to release the mouse click between the selection and the drag and drop ?

Audrey

5 Answers, 1 is accepted

Sort by
0
Accepted
Tsvyatko
Telerik team
answered on 17 Jan 2011, 11:41 AM
Hello Audrey,

As I understand, the issue you are facing is the fact that in extended mode, the listbox select/unselects its items onmousedown (rather than onmouseup). As a result drag drop operations could be performed only on single item.

So, in order to enable dragging multiple items I can suggest to try trigger the drag operation manually:

 - Save and update the selected items on mouseleftbuttonUp
 - On MouseLeftButtonDown subscribe to mousemove
 - if it exceeds the initial threshold (4 pixels is its default value) while dragging start drag using RadDragAndDropManager.StartDrag


All the best,
Tsvyatko
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Audrey
Top achievements
Rank 1
answered on 24 Jan 2011, 09:40 AM
Thank you for your help !
0
Guillaume
Top achievements
Rank 1
answered on 24 Oct 2011, 04:10 PM
Hello,

Please, can you attach a solution to understand ?

Regards,
Guillaume
0
Brian Chung
Top achievements
Rank 1
answered on 05 Aug 2015, 03:11 AM

Hello Tsvyatko,

 

Do you have a sample code for this DragDrop with multiple selection in list box? Thanks!

Brian.

0
Dimitrina
Telerik team
answered on 05 Aug 2015, 02:07 PM
Hello,

As it turns out we do not have such an exact example. You can refer to the TreeToGrid online demo as well as other demos and documentation on DragDropManager

In order to drag and drop multiple rows you have to loop through the selected items of the source ListBox and save information on all the dragged items with dragPayload on DragInitialize (through DropIndicationDetails). Basically, you should replace the CurrentDraggedItem property with the collection of items being dragged. Then, get the saved details on drop to proceed further.


Regards,
Dimitrina
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DragAndDrop
Asked by
Audrey
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Audrey
Top achievements
Rank 1
Guillaume
Top achievements
Rank 1
Brian Chung
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or