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> <RowDefinition ...

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.