Live Chat Icon For mobile
Live Chat Icon

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?

Platform: WPF| Category: Styles and Templates

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.


For example, these are the themes that Microsoft produces.



The case for classic is slightly different.


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.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.