Replies: 1 comment
-
What's wrong with using
That's how it's done in Win32 and that's exactly what |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We need to listen for theme changes in our application in order to call
FrameworkElement.UpdateDefaultStyle
on some elements in accordance with the summary tag of the method: https://github.com/dotnet/wpf/blob/v6.0.12/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Generated/FrameworkElement.cs#L124-L129How can we properly listen for theme changes? The documentation doesn't say this at all. Right now we listen for the
SystemEvents.UserPreferenceChanged
event and filter on theCategory
property in order to be notified about all color or visual style changes.In classic Win32 you'd probably listen for some messages like
WM_THEMECHANGED
andWM_SYSCOLORCHANGE
, but we can't easily do that because we have no WPF window that can intercept and handle such messages. We'd have to create an invisible native window that translates the Win32 messages into CLR events, which is also not ideal.Beta Was this translation helpful? Give feedback.
All reactions