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

Treeview Item FullPath

1 Answer 155 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 08 Feb 2012, 03:39 PM
I'm using an HierarchicalDataTemplate and the FullPath is always the type of the object in the itemssource collection. Is there a way to set it to a specific property of the bound items?  My understanding is that it was supposed to be the displayed text.

<HierarchicalDataTemplate DataType="{x:Type local:Employee}" >

<TextBlock Text="{Binding Path=Name}"></TextBlock>

</HierarchicalDataTemplate>

My Employee object has a list of employees and everything is displayed correctly.  However the FullPath of the SelectedContainer is always MyNamespace.Employee.I need the FullPath to be the Text of the node or need the ability to assign a property to be used by the FullPath for example, EmployeeId or something.
Thanks,

 

 

 

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 13 Feb 2012, 09:54 AM
Hi Patrick,

You can define a business property to be used as a path segment through the TextSearch.TextPath attached property. Setting the TextPath in the RadTreeView definition will change the way the FullPath is formed by using the TextPath value as a path segment. This is why if you want to use the Id property of your business items, you can define the RadTreeView as follows:
<telerik:RadTreeView ItemsSource="{Binding Items}"
                        ItemTemplate="{StaticResource ItemTemplate}"
                        telerik:TextSearch.TextPath="Id"/>

Greetings,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
TreeView
Asked by
Patrick
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or