I have two DataTemplates for different cells in my Treelistview control. the templates are 90% similar. How can I reuse the identical Xaml ?
<DataTemplate x:Key="@names">
<TextBlock Name="txt" Text="{Binding Names}" Style="{DynamicResource @BasicTextBlockStyle}"
Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Border},AncestorLevel=1}, Path=BorderBrush,Mode=OneWay}" />
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsVisible}" Value="True">
<Setter Property="Style" Value="{DynamicResource @HeaderTextBlockStyle}" TargetName="txt" />
</DataTrigger>
<DataTrigger Binding="{Binding IsScoped}" Value="True">
<Setter Property="Style" Value="{DynamicResource @RootElementTextBlockStyle}" TargetName="txt" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
<DataTemplate x:Key="@Ages">
<TextBlock Name="txt" Text="{Binding Age}" Style="{DynamicResource @BasicTextBlockStyle}"
Foreground="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Border},AncestorLevel=1}, Path=BorderBrush,Mode=OneWay}" />
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsVisible}" Value="True">
<Setter Property="Style" Value="{DynamicResource @HeaderTextBlockStyle}" TargetName="txt" />
</DataTrigger>
<DataTrigger Binding="{Binding IsScoped}" Value="True">
<Setter Property="Style" Value="{DynamicResource @RootElementTextBlockStyle}" TargetName="txt" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>