Animation is performed by using Storyboard.TargetName property. For example, to animate an object, the following are the steps:
- Write <BeginStoryboard> tag.
- Embed <Storyboard> tag
- Write <DoubleAnimationUsingKeyFrames> along with begin time and Storyboard.TargetName, Storyboard.TargetProperty attributes.
- Use <SplineDoubleKeyFrame> tag along with KeyTime and value attributes
- Close all the corresponding tags.
The following is the snippet of XAML file to animate an object
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.Background).
(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
<SplineDoubleKeyFrame KeyTime="00:00:0" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:1" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>