Creating a multi trigger
An active trigger can execute actions, but sometimes a trigger needs to be composed of multiple conditions that activate the entire trigger if all conditions are met. This is exactly what the MultiTrigger
and MultiDataTrigger
types are capable of. Let's see how to create a MultiTrigger
.
Getting ready
Make sure Visual Studio is up and running.
How to do it...
We'll create a simple application that changes the way a button appears by using multiple properties set up inside a MultiTrigger
:
Create a new WPF application named
CH08.MultiTriggerDemo
.Open
MainWindow.xaml
. Replace the existingGrid
with aStackPanel
.Add the following controls inside the
StackPanel
:<Button Content="Move mouse over me" FontSize="20" HorizontalAlignment="Center" Margin="20" Padding="6" x:Name="theButton" /> <CheckBox Content="Default button" Margin="10" IsChecked="{Binding IsDefault, ElementName=theButton, Mode=TwoWay}" FontSize="15"/>
Add a
Resources
property to...