I have a DataTemplate that I am using within my WPF application -
<DataTemplate x:Key="mattersTemplate">
<Border Name="border" BorderBrush="Aqua" BorderThickness="1" Padding="5" Margin="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="FileRef:"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=FileRef}" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="Description:"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Description}"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Priority:"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Priority}"/>
</Grid>
</Border>
</DataTemplate>
I then (in a DocumentSetTemplateSelector class) define which template to use;
What I would like to do / know is; Create 4 other templates that would inherit this above template AND then allow certain attributes to be over-written;
An example (this template inherits from the above class) - so they look the same;
<DataTemplate x:Key="documentSet_Accounting">
<ContentPresenter Content="{Binding mattersTemplate}"
ContentTemplate="{StaticResource mattersTemplate}">
</ContentPresenter>
</DataTemplate>
I would like for there to be a style attached to this (if possible) so to get this effect;
<DataTemplate x:Key="documentSet_Accounting">
<ContentPresenter fontsize="20" Content="{Binding mattersTemplate}"
ContentTemplate="{StaticResource mattersTemplate}">
</ContentPresenter>
</DataTemplate>
or
<DataTemplate x:Key="documentSet_Accounting">
<ContentPresenter Style="AccountingStyle" Content="{Binding mattersTemplate}"
ContentTemplate="{StaticResource mattersTemplate}">
</ContentPresenter>
</DataTemplate>
How about using style inheritance within the templates rather than template inheritance?