TreeViewItem and HierarchicalDataTemplate

0

Is it possible to use HierarchicalDataTemplate of a TreeView per Attribute and not by Type? I explain:

<TreeView x:Name="tv" >
 <TreeView.Resources>
  <HierarchicalDataTemplate DataType="{x:Type local:MeuTipo}"  >
   <Border>
    <TextBlock Text="{Binding Path=Title}" TextWrapping="Wrap" />
   </Border>
  </HierarchicalDataTemplate>

This works when the DataType is 'MyType', but would like something like:

<HierarchicalDataTemplate DataType="{x:Type local:MeuTipo, Name=Urso}"  >
<HierarchicalDataTemplate DataType="{x:Type local:MeuTipo, Name=Gato}"  >
<HierarchicalDataTemplate DataType="{x:Type local:MeuTipo, Name=Vaca}"  >

Where would you apply the template according to a 'Name' attribute of my type 'MyType'. Is it possible this way or only using Style.Triggers?

    
asked by anonymous 14.02.2018 / 21:01

0 answers