O'Reilly logo

Microsoft® Silverlight® Edition: Programming Windows® Phone 7 by Charles Petzold

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

Some Variations

I set the target property of the animation using the fully-qualified dependency property name:

Storyboard.SetTargetProperty(anima, new PropertyPath(RotateTransform.AngleProperty));

The alternative is using a string:

Storyboard.SetTargetProperty(anima, new PropertyPath("Angle"));

You might prefer that syntax because it’s shorter, but it doesn’t guarantee that you haven’t misspelled the property name.

The advantage of using strings for property names is that you can stack property names in a pile. This allows you to animate a property of an object without referencing that object itself. For example, in the Click event handler above you can set the target of the animation to be the Button instead of the RotateTransform:

Storyboard.SetTarget(anima, ...

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