1.属性触发器(依赖属性皆可,有个疑问按钮点击一下一直在闪,待研究)

wpf-触发器_触发器<Style.Triggers>
wpf-触发器_触发器                    <Trigger Property="IsMouseOver" Value="True">
wpf-触发器_触发器                        <Setter Property ="Background" Value="Green"/>
wpf-触发器_触发器                    </Trigger>
wpf-触发器_触发器</Style.Triggers>

2.MultiTrigger(满足多条件)

wpf-触发器_触发器<MultiTrigger>
wpf-触发器_触发器    <MultiTrigger.Conditions>
wpf-触发器_触发器      <Condition Property="HasItems" Value="false" />
wpf-触发器_触发器      <Condition Property="Width" Value="Auto" />
wpf-触发器_触发器    </MultiTrigger.Conditions>
wpf-触发器_触发器    <Setter Property="MinWidth" Value="120"/>
wpf-触发器_触发器  </MultiTrigger>
wpf-触发器_触发器


3.DataTrigger与上面相似

wpf-触发器_触发器      <DataTrigger Binding="{Binding Path=State}" Value="WA">
wpf-触发器_触发器        <Setter Property="Foreground" Value="Red" />
wpf-触发器_触发器      </DataTrigger>    
wpf-触发器_触发器      <MultiDataTrigger>
wpf-触发器_触发器        <MultiDataTrigger.Conditions>
wpf-触发器_触发器          <Condition Binding="{Binding Path=Name}" Value="Portland" />
wpf-触发器_触发器          <Condition Binding="{Binding Path=State}" Value="OR" />
wpf-触发器_触发器        </MultiDataTrigger.Conditions>
wpf-触发器_触发器        <Setter Property="Background" Value="Cyan" />
wpf-触发器_触发器      </MultiDataTrigger>
wpf-触发器_触发器


4.EventTrigger 根据事件触发一组动画

wpf-触发器_触发器<EventTrigger RoutedEvent="Mouse.MouseLeave">
wpf-触发器_触发器  <EventTrigger.Actions>
wpf-触发器_触发器    <BeginStoryboard>
wpf-触发器_触发器      <Storyboard>
wpf-触发器_触发器        <DoubleAnimation
wpf-触发器_触发器          Duration="0:0:1"
wpf-触发器_触发器          Storyboard.TargetProperty="MaxHeight"  />
wpf-触发器_触发器      </Storyboard>
wpf-触发器_触发器    </BeginStoryboard>
wpf-触发器_触发器  </EventTrigger.Actions>
wpf-触发器_触发器</EventTrigger>
wpf-触发器_触发器