Taking action with triggers
Triggers allow you to declare how a control should appear in your XAML based on data changes. You can also use state triggers to change a control’s Visual State, as shown earlier.
For example, we may want to enforce that the Create Account button should be disabled if the user has left the Password field blank. You can do this in code, but you can also do it declaratively in XAML using a DataTrigger
:
<Button Command="{Binding DoCreateAccountCommand}" Grid.Column="1" Grid.Row="2" Style="{StaticResource LoginButton}" Text="Create Account"> <Button.Triggers> [1] <DataTrigger Binding="{Binding Source={x:Reference...