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:<Grid Margin="8" RenderTransformOrigin=".5,.5"> <Grid.RenderTransform> <ScaleTransform ScaleX="0" ScaleY="0" /> </Grid.RenderTransform>
We'll use an event trigger to start the animation when the grid loads (the...