I'm developing a Win32 native application using XAML Islands. I notice that the XAML controls will not follow the change of system color theme. e.g. I change from 'light' to 'dark' in Settings, the controls still remain in light mode. How can I make them follow the theme change?
Asked
Active
Viewed 175 times
0
-
The [UISettings](https://learn.microsoft.com/en-us/uwp/api/Windows.UI.ViewManagement.UISettings) class exposes a number of events, like [UISettings::ColorValuesChanged](https://learn.microsoft.com/en-us/uwp/api/windows.ui.viewmanagement.uisettings.colorvalueschanged). The documentation doesn't state, whether this type can be used in a classic Desktop application. You'd have to try and see. – IInspectable Mar 23 '20 at 10:26
-
@IInspectable UISettings class is accessible. But the matter is how to set the changed theme for XAML Islands. XamlWindowManager and DesktopWindowXamlSource do not provide a property to set theme globally, and enumerating the controls and change their related properties do not sound a good idea. – TitanSnow Mar 23 '20 at 12:37
-
Can you change the default MRT context? [See here](https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.resources.core.resourcecontext.qualifiervalues). – Peter Torr - MSFT Mar 23 '20 at 18:05
-
@PeterTorr-MSFT ResourceContext::GetForCurrentView() will fail in Win32. – TitanSnow Mar 23 '20 at 23:56
-
https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.resources.core.resourcecontext.getforviewindependentuse#Windows_ApplicationModel_Resources_Core_ResourceContext_GetForViewIndependentUse – Peter Torr - MSFT Mar 24 '20 at 04:04
-
@PeterTorr-MSFT It also fails, unfortunately. – TitanSnow Mar 24 '20 at 04:17