BeginAnimation for Silverlight 2

Here’s a version of the BeginAnimation extension method, updated for Silverlight 2:     static class SilverlightHelpers    {        public static void BeginAnimation(this FrameworkElement obj, DependencyProperty property, DoubleAnimation animation)        {            var storyboard = new Storyboard();            storyboard.Children.Add(animation);            Storyboard.SetTarget(storyboard, obj);            Storyboard.SetTargetProperty(storyboard, new PropertyPath(property));            storyboard.Begin();        }    } Cut-and-paste that baby into your project, and through the magic of C# extension methods,…

1

BeginAnimation() method for Silverlight

Yeah, it’s been awhile since I’ve blogged anything, so I thought a nice way to get back in the game was to post a BeginAnimation method.  Sometimes you just want to start a simple animation in code, and the Silverlight way of doing it through storyboards just seems like more code that you feel like typing,…

3