O'Reilly logo

Pro Silverlight 5 in VB by Matthew MacDonald

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

Encapsulating Animations

When you create animations dynamically in code, a fair bit of boilerplate code is required to create the animations, set the storyboard properties, and handle the Completed event to clean up. For this reason, Silverlight developers often wrap animations in higher-level classes that take care of the low-level details.

For example, you can create an animation class named FadeElementEffect and fade an element out of view using code like this:

Dim fade As New FadeElementEffect() fade.Animate(canvas)

Creating classes like this is fairly straightforward, although the exact design depends on the needs of your application. In the rest of this section, you'll consider one possible way to create animation helper classes that ...

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