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
}

~ by Martin on August 7, 2007.

Leave a Reply