Drag and Drop with Multiple selection

6 posts, 1 answers
  1. Audrey
    Audrey avatar
    9 posts
    Member since:
    Oct 2010

    Posted 14 Jan 2011 Link to this post

    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
  2. Answer
    Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 17 Jan 2011 Link to this post

    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>>
  3. DevCraft banner
  4. Audrey
    Audrey avatar
    9 posts
    Member since:
    Oct 2010

    Posted 24 Jan 2011 Link to this post

    Thank you for your help !
  5. Guillaume
    Guillaume avatar
    39 posts
    Member since:
    Nov 2010

    Posted 24 Oct 2011 Link to this post

    Hello,

    Please, can you attach a solution to understand ?

    Regards,
    Guillaume
  6. Brian Chung
    Brian Chung avatar
    11 posts
    Member since:
    Mar 2010

    Posted 04 Aug 2015 in reply to Tsvyatko Link to this post

    Hello Tsvyatko,

     

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

    Brian.

  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 05 Aug 2015 Link to this post

    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
Back to Top
DevCraft banner