Hi Shaikh Ahmad,
When you data-bind an ItemsControl
to a collection of business objects, each source object is dynamically wrapped in a container (RadTreeViewItem
in your case). These automatically generated containers are used for visualizing the raw data in your data source. The DataTemplates
you specify determine how your data will be rendered - in your case you only need to visualize two of the properties of the business objects. Thus, you only need to bind to these two properties in the DataTemplate
you specify. However, although they are not visualized, the rest of the properties of your business objects are still accessible via the RadTreeView.Items
collection. The important distinction to make here is that the RadTreeView.Items
collection contains your raw business objects, and not the dynamically generated containers of type RadTreeViewItem
. So, if you want to access a business object after the TreeView
has been rendered on the screen, you can do so with a statement like the one below:
MyDataItem item = myTreeView.Items as MyDataItem;
I modified the example by displaying only the FirstName
and the LastName
of each employee in the RadTreeView
I also added a TextBlock
that displays the ID
of the selected employee (if an employee is selected). I accessed the ID
through the SelectedItem
property of the RadTreeViewItem
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?
Telerik Public Issue Tracking
system and vote to affect the priority of the items.