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

Hierarchical DataBinding

1 Answer 86 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
smith
Top achievements
Rank 1
smith asked on 29 Aug 2009, 01:37 PM
Populating my treeview using MVVM model not using any static Data Source

i have one class nOde Item
This class contains NodeText and Node Id  and Parrent Id

It is binding properly.  i need to set the color for each node based on the Node type Like child - blue ,parent - green
like that is this possible While Databinding itself.


1 Answer, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 29 Aug 2009, 02:26 PM
Hi smith,

If you want to change a color in the DataTemplate, you can bind a background property somewhere in your ItemTemplate.

If you want to set the Background of the TreeViewItem then you have two options:
1. Use ItemContainerStyleSelector - you create a class, similar to an ItemTemplateSelector that will return a style for the container based on whether the item is node or leaf.

2. Use ContaienrBindings to bind the Background property of the container to the data item or a proeprty of the data item. More info about ContainerBindings can be found here:

http://www.telerik.com/support/kb/silverlight/treeview/radtreeview-and-hierarchicaldatatemplate.aspx

Best wishes,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TreeView
Asked by
smith
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Share this question
or