Tag Archives: storyboard

Reusing a Storyboard

It is possible to reuse a storyboard.  Make sure to stop the storyboard before you set a new target property.  Thanks Tom for pointing this out. XAML     <Canvas x:Name=”LayoutRoot” Background=”White”> <Button Height=”20″ Width=”120″ Canvas.Left=”0″ Canvas.Top=”0″ Content=”Button” x:Name=”btnTest”/> <Rectangle x:Name=”Fred” Height=”30″ Width=”30″ Fill=”Aquamarine” Canvas.Top=”50″/> <Rectangle x:Name=”Wilma” Height=”30″ Width=”30″ Fill=”OrangeRed” Canvas.Top=”150″/> </Canvas> C#         void Page_Loaded(object [...]

How to dynamically create animations from C# in Silverlight

So you want to create an animation from managed code. To do this, there is quite a bit of code needed. For every animation there needs to be a new StoryBoard, and unfortunately a StoryBoard can not be reused between objects. (Correction: You can reuse a dynamically created StoryBoard. Make sure to call StoryBoard.Stop() before [...]

Animating multiple transforms in C# – Silverlight

Yesterday I talked about how to write C# code to animate multiple transforms of an object.  It appears, to my dismay, that at the current time you are unable to animate objects completely in C#.  There is a work around by creating a XAML storyboard and importing into a string using the XAMLReader object.  Here [...]