allow or disable drop depending on source listBox

3 posts, 1 answers
  1. Olivier Constance
    Olivier Constance avatar
    6 posts
    Member since:
    Jul 2009

    Posted 03 Jun 2014 Link to this post

    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. Answer
    Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 04 Jun 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Olivier Constance
    Olivier Constance avatar
    6 posts
    Member since:
    Jul 2009

    Posted 04 Jun 2014 in reply to Kalin Link to this post

    That's exactly what i was looking for.

    Thank you very much Kalin.
Back to Top