15.1. Understanding WPF Animation

In previous Windows-based platforms (such as Windows Forms and MFC), developers had to build their own animation systems from scratch. The most common technique was to use a timer in conjunction with some custom painting logic. WPF changes the game with a new property-based animation system. The following two sections describe the difference.

15.1.1. Timer-Based Animation

Imagine you need to make a piece of text spin in the About box of a Windows Forms application. Here's the traditional way you would structure your solution:

  1. Create a timer that fires periodically (say, every 50 milliseconds).

  2. When the timer fires, use an event handler to calculate some animation-related details, such as the new degree of rotation. ...

Get Pro WPF in C# 2010: Windows Presentation Foundation in .NET 4 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.