Introducing Animations

WPF offers lots of interesting features about graphics and multimedia to provide a great user experience with rich client applications; animations are one of these features. They enable visual elements (or just some portions of them) to move along the UI or to dynamically change their aspect during the specified interval. Subsequent sections explain how you can apply animations to WPF visual elements. There are different kinds of animations in WPF; and we cover the most common of them, DoubleAnimation and ColorAnimation.

Note

There is a special type of animation based on timelines that is not easy to implement with Visual Studio, whereas it is the easiest animation that you can realize with Expression Blend. With that said, from a developer perspective, this chapter covers animations based on storyboards.

Animations are cool in that they can also be eventually controlled by pausing, removing, stopping, and manually playing and are represented by System.Windows.Media.Animation.Storyboard objects. Each Storyboard can define one or more DoubleAnimation or ColorAnimation that applies to transformations (see previous section for details). To decide the time when animations need to come in, you define them within the control’s triggers specifying an EventTrigger that basically requires you to specify the event representing the moment for the animation to run, For example, if you want an animation to start when a window is loaded, the EventTrigger points to Window.Loaded. Before providing any code example, add a new window to your current WPF project or create a new project from scratch. When the new window is ready, divide the default Grid into four cells by typing the following XAML:

image

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.252.238