We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Platform : WPF
|
Category : Styles and Templates

How can I create a custom WPF button whose look and feel depends on the Windows desktop theme currently in use. How do I get notified when the user changes the theme?

The WPF theme engine will switch styles automatically for you if you place them in separate ’ResourceDictionary’ XAML files compiled in your application.

The files need to be named.

themes\..xaml

For example, these are the themes that Microsoft produces.

themes\luna.normalcolor.xaml
themes\luna.homestead.xaml
themes\luna.metallic.xaml
themes\royale.normalcolor.xaml
themes\aero.normalcolor.xaml

The case for classic is slightly different.
themes\classic.xaml
Windows Presentation Foundation does not provide an event to notify the user regarding theme changes. If you need to go beyond what is provided by styles in a ResourceDictionary, you will need to listen to the ’WM_THEMECHANGE’ message in a window hook.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon