可以说我有以下内容:
<Style TargetType="{x:Type TextBox}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Gray" />
<Style.Triggers>
<Trigger Property="IsFocused" Value="true">
<Setter Property="BorderBrush" Value="Green" />
<Setter Property="BorderThickness" Value="2" />
</Trigger>
</Style.Triggers>
</Style>
这工作正常,这里没有什么太大的问题,但这是一个相当简单的案例。如果我想将 IsFocused 样式状态列为显式样式会发生什么情况,如何将该样式引用为 IsFocused 样式,即
<Style x:key="ActiveStyle" TargetType="{x:Type TextBox}">
<Setter Property="BorderBrush" Value="Green" />
<Setter Property="BorderThickness" Value="2" />
</Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Gray" />
<Style.Triggers>
<Trigger Property="IsFocused" Value="true">
-- Here I want to reference ActiveStyle and not copy the copy the setters
</Trigger>
</Style.Triggers>
</Style>