希望创建多个条件都为真时才激发的触发器,就需要使用MultiTrigger提供的Condition集合
<Window x:Class="Styles.MultiTrigger"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MultiTrigger" Height="300" Width="300">
<Window.Resources>
<Style x:Key="BigFontButton">
<Style.Setters>
<Setter Property="Control.FontFamily"
Value="Times New Roman" />
<Setter Property="Control.FontSize"
Value="18" /> </Style.Setters>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions> <Condition Property="Control.IsFocused"
Value="True"></Condition> <Condition Property="Control.IsMouseOver"
Value="True"></Condition>
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter Property="Control.Foreground" Value="DarkRed"></Setter>
</MultiTrigger.Setters>
</MultiTrigger>
</Style.Triggers>
</Style>
</Window.Resources> <StackPanel Margin="5">
<Button Padding="5"
Margin="5"
Style="{StaticResource BigFontButton}">A Customized Button</Button>
<TextBlock Margin="5">Normal Content.</TextBlock>
<Button Padding="5"
Margin="5">A Normal Button</Button>
<TextBlock Margin="5">More normal Content.</TextBlock>
<Button Padding="5"
Margin="5"
Style="{StaticResource BigFontButton}">Another Customized Button</Button>
</StackPanel>
</Window>