How can I set values for items in a template from code?
I'm adding RadTreeViewItems to a treeview in code, and I need to set values on additional controls I've added to the template.
1 Answer, 1 is accepted
0
Hristo
Telerik team
answered on 06 Nov 2008, 04:54 PM
Hi Sean,
You can use VisualTreeHelper.GetChild method to get the visuals from the RadTreeViewItem template but this is not the recomended way.
The good way is to inherit RadTreeViewItem add some properties to hold your data, modify the RadTreeViewItem template to include your control and bind it to your data property. Or the easier way is to put the your data into RadTreeViewItem Tag property and bind your control to the Tag prop but this has some limitation.
If you have more questions, I'll be glad to help.
Regards,
Hristo
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.