O'Reilly logo

Windows Presentation Foundation 4.5 Cookbook by Pavel Yosifovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating property-based animations

WPF includes a sophisticated and elegant animation engine that takes animations to the declarative level. Instead of dealing with timers and graphic updates, an animation object holds all the required information for the animation to commence. WPF does the rest. In this recipe, we'll take a look at property-based animations - the simplest and most often used kind.

Getting ready

Make sure Visual Studio is up and running.

How to do it...

We'll create some property-based animations on some shapes inside a Canvas, showing the basic steps involved in creating animations:

  1. Create a new WPF application named CH09.SimpleAnimation.
  2. Open MainWindow.xaml. Add the following two rows to the existing Grid:
    <Grid.RowDefinitions> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required