Skip to content

Windows.UI.ViewManagement.UISettings.ColorValueChanged does not trigger in WinUI3 app on Windows 10 #4006

Open
@HO-COOH

Description

@HO-COOH

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
struct MainWindow : MainWindowT<MainWindow>
{
    ...
    winrt::Windows::UI::ViewManagement::UISettings settings;
};
  1. In MainWIndow.xaml.cpp
    MainWindow::MainWindow()
    {
        settings.ColorValuesChanged([](auto...)
            {
                OutputDebugString(L"Triggered");
            });
    }
  1. 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)

2023-11-30.23-24-16.mp4

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions