简体   繁体   中英

How do I create a clicked state in a Silverlight button?

How do I create a clicked state in visual state manager for a control that is based on a button control? I tried using a pressed state but once the mouse button is released it reverts back to the original color. I would like to change the color of the button when it is clicked on. I am not looking for a solution in the click event handler because this is a part of a template. Thank you

You need to derive from ToggleButton instead and use the Checked state. ToggleButton has a persistent Checked state whereas Button is only in the Pressed state while it is being clicked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM