Get up to 80 % extra points for free! More info:

Lesson 30 - Animations in C# .NET - Storyboard, Basic & Frame Animations

In the last lesson, WPF - Templates , we learned how to create a ControlTemplate and DataTemplate and we showed simple examples of their use.

WPF provides a powerful set of graphical features that we can use to "tune" our applications and give them a nice look. One option is to use animations. In a few lessons we'll gradually explain:

  • how to define animations
  • where to define animations
  • how to run animations

WPF Animations And C# Properties

Before we start creating animations, we must say that animations in WPF work on the principle of animating property values. This means that we change a value of some property over time. The property must meet the following conditions:

  • It must be a Dependency Property
  • It must belong to a class that inherits from DependencyObject and implements the IAnimatable interface

How to define animations - Storyboard

Animations are realized using scenarios (Storyboard). It's a time container that contains information about which element an animation applies to, what its property we animate and, of course, the definition of its animation.

Storyboard Example

Here is an example of such a scenario. It's very basic, but we'll show a complete demonstration in a moment. An animation scenario might look like this:


...End of the preview...
Continue further

You will gain knowledge worth hundreds of thousands for a few crowns

You've come here and that's great! We believe that the first lessons showed you something new and useful
Do you want to continue the course? Go to the premium section.

Buy this course

Buy all currently available lessons with exercise submitting and other features for just $22.50
Current account balance $0
By buying this package, you'll have access to all 42 articles (39 lessons, 3 practical exercises) in this course.

This article is licensed: Premium, by buying this article, you agree with the terms of use.

What will you get from us in the next lessons?
  • Unlimited and permanent access to individual lessons.
  • High quality IT knowledge.
  • Skills to help you get your dream and well-paid job.

Article description

Requested article covers this content:

In the WPF tutorial, we'll explain how animations work and we'll learn how to create basic linear animations and linear frame animations.

You gain credits by supporting our network. This is done by sending a helpful amount of money to support the site, or by creating content for the network.

Article has been written for you by Filip Smolík