同様の構造を使用する複数のUserControlXAMLファイルがあります。この重複を削除し、UserControlのテンプレートをオーバーライドするスタイルを使用することを考えました(次に、カスタムパーツにContentPresenterを使用します)。
しかし、どうやらUserControlのテンプレートは上書きできません。
どうすればこれをきれいに行うことができますか?UserControl以外の何かから派生しますか?
<UserControl x:Class="Class1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<sdk:Label Grid.Row="0" Content="Title1" Style="{StaticResource Header1}" />
<Border Grid.Row="1">
...
</UserControl>
<UserControl x:Class="Class2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<sdk:Label Grid.Row="0" Content="Title2" Style="{StaticResource Header1}" />
<Border Grid.Row="1">
...
</UserControl>