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

DragAndDrop - restrict to ReorderOnly?

1 Answer 29 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Mat
Top achievements
Rank 1
Mat asked on 26 May 2014, 07:35 PM
I have a couple of RadListViews - they are same except for they visualize different item collections. I need to have Draop and drop functionality to Reorder items inside list view, but I want to disallow dragging and dropping items from one list to another.

How can I accomplish this?

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 27 May 2014, 11:16 AM
Hello Mat,

You could easily achieve the desired by implementing a custom ListBoxDragDropBehavior which inherits from the default ListBoxDragDropBehavior. You will need to override the CanDrop method in order to check whether the drop will be inside of another control and if so to return false:

public override bool CanDrop(DragDropState state)
{
    if (!state.IsSameControl)
    {
        return false;
    }
 
    return base.CanDrop(state);
}

For more details about the ListBoxDragDropBehavior please check the following article from our online help documentation:
http://www.telerik.com/help/wpf/radlistbox-features-dragdrop.html

I have also attached a sample project which demonstrates the exact approach.

Hope this will work for you.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
ListBox
Asked by
Mat
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or