Re-parenting a node using drag and drop

2 posts, 0 answers
  1. Jon Barron
    Jon Barron avatar
    24 posts
    Member since:
    Oct 2012

    Posted 28 Oct 2010 Link to this post


    I've implemented drag & drop on a treeview, and one of the functions is to be able to drag a node that exists under one parent and drop it into some other parent.

    This works fine if the destination parent already has children, but when the intended parent has no child nodes, the dropped item is moved as a sibling of the intended parent, rather than being added as a child. I looked for a demo of this behavior and was unable to find a solution.

    Can ya help a brother out please?
  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 03 Nov 2010 Link to this post

    Hi Jon Barron,

    Do you databind the RadTreeView? If this is the case, then you should keep in mind a couple of things.

    Firstly, in order to implement the Drag and Drop feature on a databound tree, then you have to bind its ItemsSource to a collection that implements the INotifyCollectionChanged interface.

    Secondly, you should keep in mind that a drop is allowed only on RadTreeViewItems, which corresponding dataitems' definition contains a children collection.

    I prepared a sample project for you to have a look at. I hope it helps. Please let us know if we can further assist you.

    Kind regards,
    Tina Stancheva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top