validate listcontrol items after drag and drop

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

    Posted 20 Apr 2012 Link to this post


    I have implemented the RadItemDragDropManager example that allows me to drag multiple list items from one list control to another.

    I need to validate that the user is not dragging certain incompatible list items into the destination list control.

    The problem is that when dragging multiple items, the selected items collection isn't really preserved.

    How can I compare the items being dragged to the items in the destination list control?

    Thank you!
  2. Peter
    Peter avatar
    1160 posts

    Posted 23 Apr 2012 Link to this post

    Hi Elizabeth,

    Thank you for contacting Telerik support.

    I would like to clarify that RadItemDragDropManager example does not support scrolling and you can Drag&Drop only visible items. I can suggest checking the items in BeginDrag method. For example:
    private void BeginDrag(MouseEventArgs e)
        RadListDataItem[] selectedItems = new RadListDataItem[ this.sourceListBox.SelectedItems.Count];//TODO Count!=0
        foreach (RadListDataItem item in selectedItems)
            if(item.Text.Contains("Tuna Salad"))//exclude this item from D&D
                item.Selected = false;
    I hope this will be useful for you. Should you have further questions, I would be glad to help.

    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