Generally we have a problem in Wp7. When we click on any button the default White Color comes in view, Event occur and the button Shows again.
this behaviour is due to pressed visual state of silverlight button controll. So we need to modify this Visual state property to come back from this problem.
For this we will add a template in button and will modify its pressed state property. Follow the following Steps to achive the above:
I put my best to make this example if you got any error in above description. Please inform me with your comment. Your suggestions are always welcome.
Thanks
this behaviour is due to pressed visual state of silverlight button controll. So we need to modify this Visual state property to come back from this problem.
For this we will add a template in button and will modify its pressed state property. Follow the following Steps to achive the above:
- Create an Application and add a simple button in it by using VisualStudio 2010
- Select Required Image on it
- Save the file
- Now open this Project in Expression Blend(To Open blend Right-Click on Project in solution explorer--> choose Open In Expression Blend). The project will open in Expression blend.
- Now select the Button--> Go to Object Menu--> Select Edit Template--> Select Edit Copy...
- A dialogue box (Create Style Resource) opens
- Select Apply to all from Name Key
- Select Application from Define In (This option create the Application Resource in App.Xaml file)
- Click on OK
- Select Button Again then goto States menu on left side or on top (depends where it is present)
- Click on pressed state panelin CommenStates
- Goto Object and Timeline window--> Select the button from template
- Goto Properties window
- Open Brushes tab --> Click on the square box of Background property--> New Dialogue box opens Named Background--> Goto Template binding--> select Background
- It will show the Your default Image in template button
- Save the file.
- Now open Visual Studio(Do not close the expression Blend)
- In Visual Studio It will ask to save the all updated file outside the VS. Dont worry Click on Yes to all button.
- Run Your Application.
I put my best to make this example if you got any error in above description. Please inform me with your comment. Your suggestions are always welcome.
Thanks
No comments:
Post a Comment