microsoft / microsoft/WindowsAppSDK
Windows.UI.ViewManagement.UISettings.ColorValueChanged does not trigger in WinUI3 app on Windows 10
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 471
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 28
Description
### Describe the bug
`Windows.UI.ViewManagement.UISettings.ColorValueChanged` does not trigger when changing dark/light mode in system settings with WinUI3 (packaged) app under windows 10.
**UWP app does not have such issue.**
This issue ONLY seems to happen on Windows 10. I tried on both 17763 and 19045 and both are having issues (and both are working properly with UWP app, which is kind of funny). On Windows 11 22621, no issues.
### Steps to reproduce the bug
1. Create a new C++ WinUI3 app (packaged)
2. In `MainWindow.xaml.h`, add a member
```cpp
struct MainWindow : MainWindowT
{
...
winrt::Windows::UI::ViewManagement::UISettings settings;
};
```
3. In `MainWIndow.xaml.cpp`
```cpp
MainWindow::MainWindow()
{
settings.ColorValuesChanged([](auto...)
{
OutputDebugString(L"Triggered");
});
}
```
4. Put a breakpoint on the `OutputDebugString` line, build and run. Toggle dark/light mode in system settings, the breakpoint is **NOT** hit.
### Expected behavior
_No response_
### Screenshots
WinUI3 (left) <--------------------> UWP (right)
https://github.com/microsoft/WindowsAppSDK/assets/42881734/2589383b-fa92-44ca-a608-3ed7d9fec6db
### NuGet package version
Windows App SDK 1.4.3: 1.4.231115000
### Packaging type
Packaged (MSIX)
### Windows version
Windows 10 version 22H2 (19045, 2022 Update), Windows 10 version 1809 (17763, October 2018 Update)
### IDE
Visual Studio 2022
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the packaged C++ WinUI 3 app using MainWindow.xaml.h and MainWindow.xaml.cpp, then run it on the listed Windows 10 versions and toggle dark/light mode in system settings. Compare the callback breakpoint behavior with the stated UWP and Windows 11 results; done means identifying why the color-change callback is not triggered or documenting a verified fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100