最近我閱讀了關於樣式和控件模板。正如它所說的,控制模板負責整個控制設計。但是,我想例如更改只有默認控件模板的特定部分,例如,當鼠標移動到,或控制具有焦點,當我寫這篇:設計響應觸發器,定義和使用WPF
<Style x:Key="StyleTextBox" TargetType="TextBox">
<Setter Property="Margin" Value="5, 0"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="SelectionBrush" Value="#CCFBE6D9"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="Black" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
..whole模板得到覆蓋...它的挺不爽...
那麼如何改變isMouseOver的視覺風格,而不是重寫整個默認風格?