How do I prevent WPF buttons from remaining highlighted after being clicked?

后端 未结 7 1686
灰色年华
灰色年华 2021-02-06 21:44

When a standard WPF button is clicked, it gets highlighted in blue (probably using the blue color from whatever Windows theme is set), and it stays highlighted until you interac

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-06 22:22

    This is the default look for Aero buttons when they have focus. You can either set Focusable="False" or use a custom Style, that doesn't render it differently when the button has focus. Something like:

    xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"