Animating objects' Visibility in Silverlight
One exciting feature added in Silverlight 2 is called ObjectAnimationUsingKeyFrames. It allows you to target animations at properties that are not Double, Point, or Color. One of the most basic scenarios is to animate the Visibility property of a UIElement. Here is an example:
<Storyboard Duration="0:0:2">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="myRect" Storyboard.TargetProperty="(UIElement.Visibility)">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:01">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
Please note that in Silverlight, the only way to specify an DiscreteObjectKeyFrame's value is using property syntax (using the DOKF.Value tag). Silverlight 2 does not support WPF's x:Static markup extension. In WPF, you could specify the value using:
(note: this is NOT supported in Silverlight)
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Collapsed}">
Have fun with ObjectAnimationUsingKeyFrames!