I have a DataTemplate that I use in 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>
Then I (in the DocumentSetTemplateSelector class) determine which template to use;
What I would like to know is; Create 4 more templates that inherit this template above, and then allow you to rewrite some attributes;
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 there to be a style attached to this (if possible) in order 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>
Hexie source share