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

How to change the hierarchy (grouping) in TreeView

1 Answer 131 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 01 Jul 2009, 04:40 PM

 I want to be able to change the hierarchy in a treeview based on user request.  For example,  I have a List<vehicles> like this (below) that I want to show in a TreeView.

Ford       Red        2-door  2002
Ford       Blue       2-door  2003
Jeep      Silver     4-Door  2005
Toyota  Gray      4-door  2008
Jeep      White    Hatch    2004
Toyota  White    2-door  2001

No big deal until I want to change the grouping, that is, allow make or color or #-doors or year to be the first level in the hierarchy.  I don’t see any way to parameterize the binding source in the HierarchicalDataTemplate or use code-behind.  What I’d like to end up with is a treeview like this:

                + Ford
                                Red
                                Blue
                + Jeep
                                Silver
                                White
                +Toyota
                                Gray
                                White

Or, by a user selection, regroup the treeview to this:

                +Red
                                Ford
                +Blue
                                Ford
                + Silver
                                Jeep
                +Gray
                                Toyota
                +White
                                Jeep
                                Toyota

All the data is in a Collection (objects of class vehicle in my example) and ideally, I’d like to be able to group and sort that list using LINQ (perhaps).  Any change of implementing this with TreeView?

1 Answer, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 03 Jul 2009, 11:01 AM
Hi Jon,

we are working towards enabling this scenario for the Treeview, but for the moment only Rad GridView supports grouping out of the box.

All the best,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Jon
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Share this question
or