多属性触发器就是多个属性都满足在触发
在属性触发器上加了一些逻辑判断
举栗子
这个栗子里 textBox 要满足俩个条件 才能触发背景变色
1)textbox的 IsEnabled 为true
2) Texbox获得焦点
-
<Window.Resources>
-
<Style TargetType="{x:Type TextBox}">
-
<Style.Triggers>
-
<MultiTrigger>
-
<MultiTrigger.Conditions>
-
<Condition Property="IsEnabled" Value="True"></Condition>
-
<Condition Property="IsKeyboardFocused" Value="True"></Condition>
-
</MultiTrigger.Conditions>
-
<MultiTrigger.Setters>
-
<Setter Property="Background" Value="Coral"/>
-
-
</MultiTrigger.Setters>
-
</MultiTrigger>
-
</Style.Triggers>
-
</Style>
-
</Window.Resources>
-
<Grid>
-
<TextBox x:Name="ss" Text="多属性触发器" VerticalAlignment="Center"></TextBox>
-
<TextBox x:Name="ss1" Text="多属性触发器" VerticalAlignment="Center" Margin="0,50,0,0"></TextBox>
-
-
-
</Grid>