Skip to content

fix: Observe system theme changes when ColorValuesChanged or HighContrastChanged gets a handler (fixes #25256) - #26688

Open
seragAhmed wants to merge 1 commit into
unoplatform:masterfrom
seragAhmed:fix/25256-observe-theme-on-subscribe
Open

seragAhmed wants to merge 1 commit into
unoplatform:masterfrom
seragAhmed:fix/25256-observe-theme-on-subscribe

Conversation

@seragAhmed

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #25256

PR Type:

🐞 Bugfix

What changed? 🚀

Handlers added to UISettings.ColorValuesChanged or AccessibilitySettings.HighContrastChanged never ran when no Application had been initialized, because adding them didn't start system theme observation.

Technical details:

  • UISettings.ColorValuesChanged and AccessibilitySettings.HighContrastChanged were plain field-like events, so adding a handler never called SystemThemeHelper.ObserveThemeChanges(). Without an initialized Application, the OS theme was never observed and the events never fired.
  • Both events now have add/remove accessors. add calls SystemThemeHelper.ObserveThemeChanges(), which only does anything the first time, the same way SystemThemeHelper.SystemThemeChanged / HighContrastChanged already work.

Validation

  • Uno.WinRT Generic, Wasm and Reference build.
  • Given_HighContrastAdjustment and Given_UISettings_Accent (which subscribe to these events) pass on Skia Desktop: 22/22.
  • No new automated test: SamplesApp always initializes Application, which already starts observation, so the no-app case can't be reproduced there (the issue was also confirmed by code inspection).

PR Checklist ✅

  • 🧪 Added Runtime tests (not possible, see above)
  • 📚 Docs
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@mergify

mergify Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UISettings.ColorValuesChanged and AccessibilitySettings.HighContrastChanged do not start system theme observation

1 participant