- Open up blend and create a silverlight application project.
- Drag a button onto the grid.
3. In blend, click on the button to show the xaml. Once in xaml view, we can create a resource collection to store our storyboard.
4. Inside the resource collection create a storyboard and give it a key value. In between the storyboard tags we need to create two DoubleAnimation, one for the width property and one for the height property of the button control.
5. For each DoubleAnimation we need to set the storyboard.targetname to the control we want to animate which is the button with the name set to btnClick. Storyboard.targetpoperty will be the property name we want to change for the button (in our case the height and width). The From and To properties will change the values for the height and width during the animation. Finally we set how long we want the animation to run with the Duration property. Here the animation will run for 10 seconds.
6. Open the code behind file and create a loaded event handler in the constructor. Inside the Loaded event we will grab our storyboard from the resource collection and start our storyboard when the page load.
That's it, press F5 to run it.
Go Silverlight!
No comments:
Post a Comment