Animating States of Button In Blend 3

No.of Views566
Bookmarked0 times
Downloads 
Votes0
By  dpatra   On  04 Apr 2010 01:04:26
Tag : Silver Light and XAML , Dialog & Windows
In this article I will be discussing about different States of a Control, States represent MouseOver, MousePressed, etc. I will be creating a custom Button and we will see how we can change the animation of different states.
email bookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

In this article I will be discussing about different States of a Control, States represent MouseOver, MousePressed, etc. I will be creating a custom Button and we will see how we can change the animation of different states.

Creating a Simple Silverlight Application

Open up Blend 3 and Create a new Silverlight Application.
  

Image Loading

Creating Custom Button

Draw a Rectangle of your desirable size.
  

Image Loading

I have changed the Background as Gradient and changed the RadiusX and RadiusY to 10 each.

 

Image Loading
Image Loading

Now we will create this Rectangle as a Control. Right Click on the Rectangle and choose Make Into Control from the menu as shown below.

 

Image Loading

After clicking Make Into Control you can see a dialog box pop up as shown below.

 

Image Loading

Give a name to your Button style; in this case MyButtonStyle and click OK.
Now you can see a content presenter is added to the control and now we are in Editing the Template mode. The following figures will describe what just happened.
  

Image Loading

 

Image Loading

 

Image Loading

Now if will notice the States pane, you can see different states associated with a button. Like the following figure.

 

Image Loading

As the above figure says, we have a Base state. Base state is the original state of the Control. And further we have two different categories of states called as Common States and Focus States.


There is a property called Default transition, and by default it is 0.
 

Image Loading

You can change your desired transition delay, based on your imagination.Now we will change some of the States like MouseOver and Pressed.Click on MouseOver and you can see the recording is on now for MouseOver State.
  

Image Loading

I will just change the gradient to see the MouseOver effect.After you change something the following changes will be affected.

 

Image Loading

 

Image Loading

Now we will change the Pressed State as above.

 

Image Loading

 

Image Loading

Stop the recording and click either of the following two to go back to end editing the template.

 

Image Loading  In this case Click Button.

 

Image LoadingIn this case Click Up Arrow.

That’s it you have successfully used the States to change a Custom Button effect. Play around with it more so that you will have a grip on it.

Enjoy Animating.Enjoy.
 

 
Sign Up to vote for this article
 
About Author
 
dpatra
Occupation-Not Provided
Company-Not Provided
Member Type-Expert
Location-Not Provided
Joined date-13 Jul 2009
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top