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

allow or disable drop depending on source listBox

2 Answers 183 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Olivier Constance
Top achievements
Rank 1
Olivier Constance asked on 03 Jun 2014, 11:00 AM
Hello

I have a windows with 4 radListBox.

this 4 rad listbox are binded to 4 Observable collection of the same Object type.

so i have radlist box A, B, C and D

what i want is :

 allow drag and drop
-betwen A and B (any directtion)
-between C and D (any direction)

disable drag and drop for all other posssibilities
-between B and C
-between B and D
-between A and C
-between A and D

i had already achieve this with radList box containing different type of Object by testing the type, but here i can't do it because all the radListBox contains the same type of object.

Any suggestion?

2 Answers, 1 is accepted

Sort by
0
Accepted
Kalin
Telerik team
answered on 04 Jun 2014, 10:21 AM
Hi Olivier,

What I can suggest you would be to divide the ListBoxes logically into two groups between which the drag drop will be possible. Afterwards you will need to implement a custom ListBoxDragDropBehavior with one public property that will contain the group name and a static field that will contain the group name from which the drag operation has started. You will have override the CanStartDrag method in order to set the static field and the CanDrop method in order to check whether the current group is the starting one. For your convenience I have prepared 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.
 
0
Olivier Constance
Top achievements
Rank 1
answered on 04 Jun 2014, 12:56 PM
That's exactly what i was looking for.

Thank you very much Kalin.
Tags
DragAndDrop
Asked by
Olivier Constance
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Olivier Constance
Top achievements
Rank 1
Share this question
or