Add and remove multiple listbox items

2 posts, 0 answers
  1. Elizabeth
    Elizabeth avatar
    3 posts
    Member since:
    Feb 2012

    Posted 06 Apr 2012 Link to this post

    I actually implemented the drag and drop example from the demo. There are two list boxes where I can drag and drop or use a button to move a selected item from one list box to the other.

    I would like to modify it so that I can select multiple items and click the "add selected" button or drag them.

    Here's how I am currently trying to move selected but it seems to remove all of the items.

    private void RemoveSelectedFromListBox(RadListControl sourceListBox, RadListControl targetListBox)
                if (sourceListBox.Items.Count == 0) { return; }
                if (sourceListBox.SelectedItems == null) { return; }
                for (int i = 0; i < sourceListBox.SelectedItems.Count; )
                    RadListDataItem item = sourceListBox.SelectedItems[i];

    Do you have an example for the drag and drop of multiple selected items? and do I use MultiExtended or MultiSimple?

    Thank you,
  2. Nikolay
    Nikolay avatar
    1805 posts

    Posted 09 Apr 2012 Link to this post

    Hello Elizabeth,

    Please find attached a sample project which demonstrates how you can move a group of items (the selected ones) from one RadListControl to another. The implementation in this sample project allows you to move the items on a button click or on a drag and drop operation. Please note that the drag'n'drop outline will still only represent the item that is actually being dragged, as due to the virtualization enhancements of the control you are not able to get the visual representation of all selected items.

    I hope this helps.

    All the best,
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top