Click here to Skip to main content
12,763,750 members (38,178 online)
Click here to Skip to main content
Add your own
alternative version


46 bookmarked
Posted 26 Nov 2008

A simple animation button in Silverlight

, 26 Nov 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
This article shows you how we can create an animation button in Silverlight.


This is a simple tutorial that shows you how to create an animation button in Silverlight 2. I didn't write the XAML code by myself, I used Expression Blend 2.

Using the code

For an animation button with three states, we should first create three storyboards.

silverlight animation button

Then, in each storyboard, we should create a key frame to show the new state, something like this:

silverlight animation button

Be careful, we mustn't use the key frames like this:

silverlight animation button

because the animation will show incorrectly.

After that, we should control the animation with events. I used these methods to do that:

private void buttonGrid_MouseEnter(object sender, MouseEventArgs e)

private void buttonGrid_MouseLeave(object sender, MouseEventArgs e)

private void buttonGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)


  • 27th November, 2008: First post.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Mohammad Dayyan
Iran (Islamic Republic of) Iran (Islamic Republic of)
No Biography provided

You may also be interested in...

Comments and Discussions

-- No messages could be retrieved (timeout) --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 26 Nov 2008
Article Copyright 2008 by Mohammad Dayyan
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid