microsoft / microsoft/microsoft-ui-xaml

x:Bind to ActualTheme does not update when the control's theme actually changes

Open
#10,390 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

Describe the bug

Continue from #10389 , when x:Bind to a UserControl.ActualTheme actually compiles, it does not trigger update when the theme actually changes.

Steps to reproduce the bug
  1. Create a new C++ project
  2. Create a new UserControl called MyControl
  3. Use this xaml
    <StackPanel>
        <local:MyControl x:Name="MyControl" />
        <TextBlock Text="{x:Bind local:MyPage.ElementThemeToString(MyControl.ActualTheme), Mode=OneWay}" />
    </StackPanel>
  1. Build and run, switch theme in windows settings, the text is not updated.
Expected behavior

No response

Screenshots

Image

NuGet package version

None

Windows version

No response

Additional context

Repro

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked WinUI-Bug repro, especially the 26-xBindToActualThemeNoUpdate project, and reproduce the theme switch with the shown UserControl and TextBlock binding. Then trace the x:Bind and ActualTheme notification path, using #10389 for context. Done means the TextBlock updates when the Windows theme changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.