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

Re-parenting a node using drag and drop

1 Answer 34 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jon Barron
Top achievements
Rank 1
Jon Barron asked on 28 Oct 2010, 10:09 PM

Hi,

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?

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 03 Nov 2010, 11:56 AM
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
Tags
TreeView
Asked by
Jon Barron
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or