How to remove ButtonChrome border (when defining the template of a border)?

前端 未结 7 1896
被撕碎了的回忆
被撕碎了的回忆 2020-12-06 02:02

I followed ChrisF here and write a simple demo.

...open your project in Expression Blend, select the button and then right click and

7条回答
  •  自闭症患者
    2020-12-06 02:36

    You should not try to customize ButtonChrome. *Chrome classes are theme-specific, i.e. they contain implementation of a specific windows theme and you cannot override it. Look at the declaration of the "Microsoft_Windows_Themes" namespace in your resource dictionary - it probably contains something like PresentationFramework.Aero...

    What you should do in your custom templates is use usual Border instead of ButtonChrome and define triggers that will change its background, etc. when the button is pressed or hovered.

    Here is an example: