I want to modify the ZIndex of a button on mouseover / focused state from the style and not from codebehind.
Asked
Active
Viewed 207 times
0
-
It works. http://stackoverflow.com/a/3609642/1292399 – AlexEdunov Feb 18 '13 at 03:44
-
I dont think it works for Silverlight..I need it for Silverlight as well.. ( modified the title..actually I need this for Silverlight) – Jigar Sheth Feb 18 '13 at 05:33
1 Answers
1
You cant really do this with a style.
The best you can hope for in that regard is to create a Behavior that will change the ZIndex property. But then you have got to create an Attached Property for the Behavior so you can set it in a Style. It will work, but you should consider another approach.
You can define a Visual State in your Page/View. Then using Interaction Triggers, you can trigger that Visual State with a GoToState Action on MouseOver and GotFocus.
Edit: If it is re-usability you seek, derive a type from Button and use your type instead. You can then define any behavior that comes to mind from code in your Button.

Community
- 1
- 1

Silver Solver
- 2,310
- 1
- 13
- 19
-
Thanks for the suggestion. Problem is I need to have common style for button because this style needs to be reused in multiple pages/views for many buttons across the application. – Jigar Sheth Feb 18 '13 at 07:39