DragDropManager Prevent Drop, retain dropped item

4 posts, 0 answers
  1. Justin Lee
    Justin Lee avatar
    149 posts
    Member since:
    Dec 2009

    Posted 28 Aug 2013 Link to this post

    Hello,

    I have 2 RadTreeViews.  Users can drag from Tree A to Tree B.  I had this working with RadDragAndDropManger, but an struggling to get it right with DragDropManager. 

    I'm trying to do the following 2 things, using DragDropManager:

    1. When the user drags an item from Tree A onto Tree B, do a check based on properties of the item whether the item can be dropped, and cancel the drop if needed.  (optionally, display as they are dragging that the item cannot be dropped in Tree B)

    2. When an item is successfully dropped into Tree B, the item should still exist in Tree A.


    Thanks,
    Justin

  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 02 Sep 2013 Link to this post

    Hi Justin,

    First you need to allow the RadTreeView to use the DragDropManager for the drag and drop logic. You can do this by setting the telerik:TreeViewSettings.DragDropExecutionMode property to New and the IsDragDropEnabled property to True.

    Furthermore, you need to subscribe to some of the events of the DragDropManager and customize the default logic. In order to check if a drop operation is possible and update the drag visual you can subscribe to the DragOver event and TreeViewDragDropOptions.DropAction to None. You can find more information here.

    Regarding, your second requirement you can take a look at this article where we described how you can achieve this behavior.

    I hope this information is helpful.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Bernd
    Bernd avatar
    3 posts
    Member since:
    Sep 2012

    Posted 20 Dec 2013 Link to this post

    Hi Pavel,

    we've migrated from a 2012 Version directly to Q3 2013 Sp1 and - surprise - our drag 'n drop functionality did not work anymore. This hint (telerik:TreeViewSettings.DragDropExecutionMode and IsDragDropEnabled)
    finally helped us - thank you.

    Maybe a hint to those settings in the section "Changes and backwards compatibility" would have been helpfull. One could even go so far to consider this as a "breaking change" ... 

    Best regards and a happy new year,
    Bernd
  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 25 Dec 2013 Link to this post

    Hello Bernd,

    Actually it is mentioned that the built-in DragDrop API is refactored. You can find it under the What's New section of the Q2 2013 release history.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top