Creating an event trigger
We've seen property triggers and data triggers. Both triggers are based on comparing a property to a value. The third type of supported trigger is an event trigger. This trigger type fires when a routed event occurs, executing animation-related actions. Let's see how to configure an event trigger.
Getting ready
Open the CH08.StyledCalculator
project.
How to do it...
We'll continue with the calculator sample by making the UI come into view with an animation set up by an event trigger:
- We want the calculator UI to start from a zero size and reach its full size using an animation when the application starts. Open
MainWindow.xaml
. - Add a starting point for the animation with a transformation properties to the main
Grid
as follows: ...
Get Windows Presentation Foundation 4.5 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.