Treeview Item FullPath

2 posts, 0 answers
  1. Patrick
    Patrick  avatar
    10 posts
    Member since:
    Nov 2011

    Posted 08 Feb 2012 Link to this post

    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,

     

     

     

  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 13 Feb 2012 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top