July 2017
Beginner
466 pages
9h 37m
English
Event triggers are generally used to perform actions when the routed events of the associated FrameworkElement arises. This is mainly used in animations to control the look when a certain UI event raises.
In the following example, we have a Textblock control. By default, its size is set to 30 with an opacity level of 20%. It has two events, MouseEnter and MouseLeave, associated with it. Now, on mouse hover we need to specify an animation to grow the font size to 50 and the opacity to 100%. Similarly, on mouse leave, we need to bring it back to the initial state.
Here, the event trigger will help you to perform the same within the XAML page:
<TextBlock Text="Hover here" FontSize="30" Opacity="0.2" HorizontalAlignment="Center" ...
Read now
Unlock full access