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

Programmatically Changing HierarchicalDataTemplate

2 Answers 116 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Simon Cuce
Top achievements
Rank 1
Simon Cuce asked on 21 Dec 2008, 10:33 PM
Hi Guys

I'm currently using databinding on a treeview with HierarchicalDataTemplates. All works well. But i want to have more control of the template based on the node selected. FYI I use on demand loading and have templates for all the different data types

For example, i want a tree to look like this (high level set, different types binded)

A---- type1
B --- Type2 -----type1
                  ------ type1
C ---- Type2 ------type 1
                    ------type 1

I have captured the event when the high level nodes are click. Depending on which node is selected (If A then show data as per type1 or if B or C then show data as per type 2). What makes this a little more complex is that type 2 child is type 1.

So is there are way to control the the binding and view programmatically.

Simon

2 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 22 Dec 2008, 07:53 AM
Hello Simon Cuce,

This is a classic problem which is solved by using TemplateSelector.
Check this sample for more info:
http://demos.telerik.com/silverlight/#TreeView/TemplateSelector

Kind regards,
Valentin.Stoychev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Simon Cuce
Top achievements
Rank 1
answered on 22 Dec 2008, 09:41 PM
Cheers for this....it worked prefectly...thanks guys
Tags
TreeView
Asked by
Simon Cuce
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Simon Cuce
Top achievements
Rank 1
Share this question
or