Simple Animation (TargetProperty to ScaleX) in XAML Silverlight: Part 2


Introduction

In Silverlight, we create animations to compete 'adobe flash' but till now we have not created any such project which assumes something like this, we just saw how to transform an element by using static compositions. As we saw multiple types of transformations, we'll see multiple types of animations too in my coming posts. Here you will see 'DoubleAnimation' and we have also another one that is 'DoubleAnimationUsingKeyFrames' (will discuss it later). Here you'll go with only 'DoubleAnimation'.

Look at the XAML Code below:

XAML Code

image001.png

Continue from previous part here.

In above code, I strike <TransformGroup> root because inside this I'm only using single transform element that is <ScaleTransform> but in case if you have multiple transform, you have to use <TransformGroup>. Review my previous post titled "TransformGroup in XAML Silverlight" for more.

<ScaleTransform> has name 'Action1' and it has only one scale property that is 'ScaleX' so, similarly we have used 'ScaleX' only in <DoubleAnimation>.

Let's move to <DoubleAnimation> section now. In this section please note we have 'Storyboard.TargetName' is 'Action1' and 'Storyboard.TargetProperty' is 'ScaleX' these properties can be assumed as called part of <ScaleTransform> attribute.

If you run above code, you will find 'TextBlock' text is being doubled on X axis and this animation repeats forever because of properties 'RepeatBehaviour' and 'AutoReverse'.

In next part we will combine ScaleX and ScaleY. Be tuned.

HAVE A HAPPY CODING!!

Up Next
    Ebook Download
    View all
    Learn
    View all