microsoft / microsoft/microsoft-ui-xaml
Leaving high contrast can leave app display a bunch of red instead of accurate colors
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
When a WinUI 3 application uses an explicit RequestedTheme ( Light or Dark ) and performs lookups through theme dictionaries, framework resources can remain stale after Windows High Contrast is enabled and then disabled.
The issue affects both resources read programmatically and existing ThemeResource bindings used by controls.
Reproduction steps
1. Launch the attached standalone WinUI 3 repro.
2. Select System default, Light, or Dark in the application.
3. Enable a Windows High Contrast theme, such as Aquatic.
4. Exercise the sample controls and use the resource materialization buttons.
5. Disable High Contrast by selecting None in Windows Settings.
6. Select Light or Dark again in the repro.
7. Compare the control brushes and the resource values reported in the output log.
[WinUIThemeDictionaryLookupRepro.zip](https://github.com/user-attachments/files/31742771/WinUIThemeDictionaryLookupRepro.zip)
### Why is this important?
This leaves the app in a very weird state, the app should not light up completely red
### Steps to reproduce the bug
Reproduction steps
1. Launch the attached standalone WinUI 3 repro.
2. Select System default, Light, or Dark in the application.
3. Enable a Windows High Contrast theme, such as Aquatic.
4. Exercise the sample controls and use the resource materialization buttons.
5. Disable High Contrast by selecting None in Windows Settings.
6. Select Light or Dark again in the repro.
7. Compare the control brushes and the resource values reported in the output log.
### Actual behavior
Some framework brushes and existing ThemeResource bindings remain stuck at their High Contrast or fallback values after the theme transition. Programmatic lookups can also return stale values or the red fallback value ( #FFFF0000 ) even though the application has returned to an explicit Light or Dark theme.
### Expected behavior
After High Contrast is disabled, framework theme resources and existing ThemeResource bindings should be re-resolved using the active Light or Dark theme. Controls and programmatic lookups should consistently show the current theme’s values.
### Screenshots
_No response_
### NuGet package version
2.4.0
### Windows version
Windows 11 (26H1): Build 28000
### Additional context
_No response_
Contributor guide
Research direction
Start with the attached WinUIThemeDictionaryLookupRepro.zip and reproduce the transition from an explicit Light or Dark theme to Windows High Contrast and back to Light or Dark. Exercise the sample controls and resource materialization buttons, then compare the control brushes and output-log resource values before and after the transition. Done means framework resources, existing ThemeResource bindings, and programmatic lookups consistently show the active theme’s values instead of stale or red fallback values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100