如何在 Style="{StaticResource 中使用多个键(在 ResourceDictionary 中使用)
顶部标题}"
如何在 Style="{StaticResource 中使用多个键(在 ResourceDictionary 中使用)
顶部标题}"
您可以在新创建的样式中组合多种样式。例如:
<Style x:Key="Style1" TargetType="Button">
<Setter Property="Background" Value="Yellow" />
</Style>
<Style x:Key="Style2" TargetType="Button">
<Setter Property="Foreground" Value="Red" />
</Style>
<Style x:Key="Style1Style2" TargetType="Button">
<Setter Property="Background" Value="Yellow" />
<Setter Property="Foreground" Value="Red" />
</Style>
或者您可以创建 BasedOn 样式:
<Style x:Key="Style3" TargetType="Button" BasedOn="{StaticResource Style2}">
<Setter Property="Background" Value="Yellow" />
</Style>