When an animation is completed

The following code snippet is about how to execute certain functions after an animation is completed in WPF. The same pattern can be applied whenever an event of animation is triggered.

{
StoryBoard sb = SomeUserControl.Resources[“SomeKey”] as Storyboard;
sb.Completed += new EventHandler(sb_Completed);
sb.Begin(SomeFrameworkElement);
}

private void sb_Completed(Object sender, EventArgs args)
{
//functions contents
}

Advertisements

~ by Martin on August 7, 2007.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: