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

Hierarchy of same object bound

1 Answer 68 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 18 Nov 2012, 04:01 AM
Simple question that I was not quite able to find an answer to...
I have a binding list collection of Person objects.  Each Person object has a collection of Person objects.  For example, everyone is a person.  Some persons have children.  They are persons.  They can have kids, and so on and so on.

I bound this to a tree view but only got the first level of items.  I then added ParentMember and ChildMember values - these are used for a simple collection as compared to my hierarchy of same nodes thus it did not work.  I then tried to use the Object Relation mode and specified a display value that hit the first level of nodes and then went to the second level - "PersonName\\PersonName".  I did the same with the ValueMember.  Great, I now got two levels of tree control. 

The question is how to get N levels?  Do I do something like "PersonName\\*" in an attempt to tell it to repeat?  Do I need to do this manually rather than binding?

And lastly, I did read that Drag And Drop will NOT work with bound Trees.  If that is the case then I will do all of this work manually - I would think that you could support drag and drop but would have to rely on my code to actually do the movement of the actual data structure.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 22 Nov 2012, 07:34 AM
Hello Dan,

Thank you for contacting Telerik support.

What I can suggest is to use self-reference data binding to display the desired hierarchical data. Please, refer to the attached project.

As to the drag and drop, it is not supported in bound mode, since the data binding scenarios are multiple and each one has some restrictions.

Do not hesitate to contact us if you have other questions.

All the best,
Peter
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
Treeview
Asked by
Dan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or