Control Storyboards Easily using Behaviors

It’s been a while since the last article where I promised to write about all of the behaviors that ship with Expression Blend in greater detail. I’ll try to be more prompt in the future. Today, let’s look at the ControlStoryboardAction and the StoryboardCompletedTrigger.

Storyboards are one of the primary ways you create animations in Silverlight, WPF, and Windows Phone using Expression Blend. Creating a storyboard is fairly easy, but actually using a storyboard such as having it play is not. To help with this, you have the ControlStoryboardAction.

What is it?

Simply put, the ControlStoryboardAction is an Action that allows you to select a storyboard and specify what you would like to do to it:


Let’s look at some of the properties it contains in greater detail.

Using It

When it comes to this behavior, there are only two properties that you need to concern yourself with. They are the ControlStoryboardOption and Storyboard properties.

The ControlStoryboardOption property lists the tasks you would like to perform:


From here you can choose whether you want to play a storyboard, stop it, toggle between play/pause, pause, resume, or jump to the end.

The only missing piece so far is knowing which storyboard to affect. Not to worry, because you specify the storyboard using the aptly named Storyboard property:


This property will list all of the Storyboards your behavior has access to. Once you have selected a Storyboard, you are done!


Another little behavior component we have is the StoryboardCompletedTrigger:


This trigger invokes an Action when a specified storyboard (set via the Storyboard property) has fully run to completion. Of course, because it is a trigger, you can use it with any Action.

Kirupa =)