microsoft / microsoft/microsoft-ui-xaml
x:Bind to ActualTheme does not update when the control's theme actually changes
Open
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
- Create a new C++ project
- Create a new
UserControlcalledMyControl - Use this xaml
<StackPanel>
<local:MyControl x:Name="MyControl" />
<TextBlock Text="{x:Bind local:MyPage.ElementThemeToString(MyControl.ActualTheme), Mode=OneWay}" />
</StackPanel>
- Build and run, switch theme in windows settings, the text is not updated.
Expected behavior
No response
Screenshots
NuGet package version
None
Windows version
No response
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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