As in the case of color, you can also easily animate the size of an element. In this recipe, you will learn how to animate the width and height of a rectangle and how to automatically reverse the animation when it is completed.
To prepare the example that animates the size of a rectangle, perform the following steps:
Add a rectangle to the page and define a storyboard to resize the rectangle. Do this by modifying the content of the
MainPage.xaml
file, as follows:<Page (...)> <Page.Resources> <Storyboard x:Name="RectangleResize"> <DoubleAnimation Storyboard.TargetName="RectangleMain" Storyboard.TargetProperty="Width" To="200" Duration="0:0:1" AutoReverse...