Repository navigation
Fix themed foreground on RichTextBlock - #1655
Alexandre Zollinger Chohfi (azchohfi) merged 4 commits into
Conversation
|
Could we take a look at the current approach together? The existing The patch extends that check so the existing call can use WinUI’s I’d appreciate your thoughts on whether this approach fits the issue. Existing generic overload · Runtime receiver check |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the RichTextBlock foreground theming change.
No open issues 🎉
What changed in this PR
Fixes #1002 by routing RichTextBlock foreground theme tokens through Reactor’s existing theme-resource binding path, without changing public signatures or overload resolution.
Changes:
- Enables themed foreground on
RichTextBlockand makesREACTOR_MOD_003distinguish themed and generic brush overloads. - Adds regression coverage for theme changes, brush transitions, binding removal, and analyzer receiver checks.
- Removes the
StepCard.csdiagnostic exemption and updates documentation and the changelog.
| File | Description |
|---|---|
| tests/Reactor.Tests/AnalyzerTests/NoOpModifierAnalyzerTests.cs | Tests supported themed calls and unsupported generic calls. |
| tests/Reactor.Tests/AnalyzerTests/ModifierTableIntegrityTests.cs | Validates separate theme receiver lists against reconciler behavior. |
| tests/Reactor.Tests/AnalyzerTests/AgentKitSnippetWalker.cs | Clarifies comments about syntax-only overload checking. |
| tests/Reactor.AppTests.Host/SelfTest/SelfTestFixtureRegistry.cs | Registers the new foreground regression fixture. |
| tests/Reactor.AppTests.Host/SelfTest/Fixtures/ThemeRefStyleFixtures.cs | Covers live theming, brush transitions, and binding removal. |
| src/Reactor/Elements/ElementExtensions.cs | Documents supported themed foreground receivers. |
| src/Reactor/Core/Reconciler.cs | Enables foreground theme bindings for RichTextBlock. |
| src/Reactor.Analyzers/NoOpModifierAnalyzer.cs | Selects the receiver list for the resolved overload. |
| src/Reactor.Analyzers/ModifierTable.cs | Declares the themed foreground receiver list. |
| src/Reactor.Analyzers/AnalyzerReleases.Unshipped.md | Updates the diagnostic description. |
| samples/.editorconfig | Removes the StepCard.cs exemption and refreshes explanatory comments. |
| plugins/reactor/skills/reactor-build-and-check/SKILL.md | Documents overload-specific foreground support. |
| docs/guide/text-and-media.md | Adds generated guidance for themed rich text. |
| docs/guide/analyzer-architecture.md | Updates generated analyzer guidance. |
| docs/_pipeline/templates/text-and-media.md.dt | Adds themed rich-text guidance to the source template. |
| docs/_pipeline/templates/analyzer-architecture.md.dt | Documents overload-specific receiver checks in the source template. |
| CHANGELOG.md | Records the foreground theming fix. |
Review effort: Balanced
Alexandre Zollinger Chohfi (azchohfi)
left a comment
There was a problem hiding this comment.
Fix looks right to me. The themed Style path, pooling cleanup and the brush to theme to none transitions all check out, and the selftest would go red if the Reconciler line were reverted. A few small things inline, none blocking.
Check explicit theme gates against ApplyModifiers and verify the shipped ThemeRef receiver lists.
|
Thanks for the review! I kept the analyzer-to-runtime equality check and added a superset check so an explicit theme gate must cover every receiver supported by I’ll follow up separately on sharing the foreground dependency-property lookup across the three paths, including support for |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Alexandre Zollinger Chohfi (azchohfi)
left a comment
There was a problem hiding this comment.
Thanks, both fixes look good. Merged main to fix the CHANGELOG conflict.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
dbda02a
into
microsoft:main
|
Filed #1674 for the shared Foreground lookup and AnimatedIcon follow-up. |
Summary
RichTextBlock("Hello").Foreground(Theme.PrimaryText)compiled, but the reconciler skipped the foreground theme binding. This PR addsRichTextBlockto the existing{ThemeResource}foreground path so its default text brush follows the control's effective theme.REACTOR_MOD_003use the receiver list for the resolved overload. The analyzer accepts themed foreground onRichTextBlockand still flags unsupported calls through the generic brush overload.StepCard.csdiagnostic exemption and update the guides, agent-kit documentation, and changelog.Linked issue / spec
Fixes #1002.
Test plan
MSB3277assembly version warnings.ThemeRefStyleWinUI selftests. The new regression fixture failed three brush assertions before the fix and passed after it. It covers initial binding, a live theme change, switching between an explicit brush and a theme token, and removing the binding on the same control.StepCard.csexemption removed.The full Debug unit suite reported 16,238 passed, 18 skipped, and 2 failures in the CLI's
CS1503suggestion tests under the machine's default locale. Both failing tests passed when rerun withDOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1.Risk / breaking changes
Existing calls keep the same public signatures and overload resolution. The visible behavior change is that a theme token now sets the default foreground on
RichTextBlock. The existing string and brush overloads continue to use the control descriptor.