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

RIA RadTreeView Self-Ref Hierarchy HowTo?!?

1 Answer 124 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
David asked on 07 Aug 2010, 04:09 AM
I'm a bit frustrated.  Is there a step-by-step walkthrough of populating a RadTreeView via RIA and to display using a self-referencing table?

Is there a step-by-step walkthrough on the HierarchicalDataTemplate (HDT)?  Is the only way to create a HDT is manually typing the xaml?  Do you need a HDT to have the RadTreeView display parent-child relationship data?

I'm looking for something like this:
1)  Create your RIA business project
2)  Add the DataModel to the Web Project and compile
3)  Add the DomainService to the Web Project and compile
4)  Add a RadTreeView to the home.xaml page of the silverlight project
5)  Drag your datasource on to the RadTreeView
6)  (wishful thinking) Drag a HTD object to the RadTreeView
7)  (more wishful thinking) Drag your datasource to the HDT too
8)  (ditto) Set the id field property on the HDT object
9)  (ditto) Set the parent field property on the HDT object
10)  (ditto)  Run it and it works...

I've not been able to find anything like a walkthrough like this.

Please don't point me to code samples.  they're great but I end up going in circles trying to figure out what properties of the HDT do.


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 11 Aug 2010, 05:50 PM
Hi David,

Yes, the HieradhicalDataTemplate (HDT) is needed. It is a standard DataTemplate and the only property that you need to know about initially is the ItemsSource

<telerik:HDT ItemsSource="{Binding Children}" />

Where "Children" is a property on your model which contains its sub-items.

We have not been able to integrate this with VS / Blend and the ItemSource has to be added manually in code.

The TreeView follows Wpf / SL pattern where the hierarchy is made from parent -> children relationships and not child -> parent and using the latter does involve some code.

If you are using RIA services I can suggest letting the framework to manage the hierarchical relationship for you, since it will generate and maintain Children properties on your model.

You probably have seen the help already, so I wont point you to it.

Instead I am attaching a project where the self-reference hierarchy is managed by RIA services (I use LinqToSql but EntityFramework can be used just as well).

This is a video which explains populating the  TreeView with a RIA services:

It is about an already created app and not quite the guide that you describe, but I hope that you will find it useful.

Best wishes,
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
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question