Skip to content

Use DynamicResource for TextBox SelectionBrush#4322

Open
Jack251970 wants to merge 1 commit intodevfrom
FixSelectionBrush
Open

Use DynamicResource for TextBox SelectionBrush#4322
Jack251970 wants to merge 1 commit intodevfrom
FixSelectionBrush

Conversation

@Jack251970
Copy link
Member

@Jack251970 Jack251970 commented Mar 4, 2026

Changed SelectionBrush in TextBox style from StaticResource to DynamicResource for SystemAccentColorLight1Brush.

Resolve #4298. Tested by participants in #4298


Summary by cubic

Switches the TextBox SelectionBrush from StaticResource to DynamicResource so the selection color updates live with the system accent. Improves theme responsiveness and fixes #4298.

  • Summary of changes
    • Changed: SelectionBrush in Win11Light TextBox style now uses DynamicResource for SystemAccentColorLight1Brush, enabling runtime updates when the accent color changes.
    • Added: Live resource lookup for the selection highlight to reflect system/theme changes without restart.
    • Removed: Dependency on a static resource lookup that froze the selection color at load.
    • Memory: No meaningful impact; DynamicResource adds negligible lookup overhead but no measurable memory growth.
    • Security: No risk; XAML style-only change.
    • Tests: No unit tests added; verified manually by participants in BUG: Unable to cast object of type 'System.Windows.Media.Color' to type 'System.Windows.Expression' #4298.

Written for commit 71944ab. Summary will update on new commits.

Changed SelectionBrush in TextBox style from StaticResource to DynamicResource for SystemAccentColorLight1Brush. This enables automatic updates to the selection color when the resource changes at runtime, improving theme responsiveness.
Copilot AI review requested due to automatic review settings March 4, 2026 10:43
@github-actions github-actions bot added this to the 2.2.0 milestone Mar 4, 2026
@prlabeler prlabeler bot added the bug Something isn't working label Mar 4, 2026
@gitstream-cm
Copy link

gitstream-cm bot commented Mar 4, 2026

🥷 Code experts: jjw24

jjw24 has most 👩‍💻 activity in the files.
jjw24 has most 🧠 knowledge in the files.

See details

Flow.Launcher/Themes/Win11Light.xaml

Activity based on git-commit:

jjw24
MAR
FEB
JAN
DEC
NOV
OCT

Knowledge based on git-blame:
jjw24: 100%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@gitstream-cm
Copy link

gitstream-cm bot commented Mar 4, 2026

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

@Jack251970 Jack251970 enabled auto-merge March 4, 2026 10:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Windows 11 Light theme’s TextBox styling to resolve a crash triggered by Windows theme/accent changes by switching the SelectionBrush lookup to a runtime-updating resource reference.

Changes:

  • Changed QueryBoxStyle’s SelectionBrush from {StaticResource ...} to {DynamicResource ...} in Win11Light.xaml.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 003b5326-6cce-4188-8645-a86afb8b48f7

📥 Commits

Reviewing files that changed from the base of the PR and between 984b3da and 71944ab.

📒 Files selected for processing (1)
  • Flow.Launcher/Themes/Win11Light.xaml

📝 Walkthrough

Walkthrough

The change switches the resource binding for QueryBoxStyle.SelectionBrush in the Win11Light theme from a static resource to a dynamic resource. This allows the brush to update at runtime when system accent colors change, rather than being fixed at load time.

Changes

Cohort / File(s) Summary
Theme Resource Binding
Flow.Launcher/Themes/Win11Light.xaml
Changed QueryBoxStyle.SelectionBrush from StaticResource SystemAccentColorLight1Brush to DynamicResource SystemAccentColorLight1Brush to support dynamic theme updates.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

bug

Suggested reviewers

  • jjw24
  • onesounds
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Use DynamicResource for TextBox SelectionBrush' directly describes the primary change made in the pull request.
Description check ✅ Passed The description clearly explains the change from StaticResource to DynamicResource and references the resolved issue #4298 with testing confirmation.
Linked Issues check ✅ Passed The PR addresses issue #4298 by switching SelectionBrush to DynamicResource, which enables runtime updates when system accent colors change, directly resolving the InvalidCastException during theme changes.
Out of Scope Changes check ✅ Passed All changes are scoped to the Win11Light.xaml theme file and directly address the SelectionBrush resource reference issue; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch FixSelectionBrush

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Unable to cast object of type 'System.Windows.Media.Color' to type 'System.Windows.Expression'

2 participants