Skip to content

Use DynamicResource for TextBox SelectionBrush#4308

Closed
Jack251970 wants to merge 1 commit intodevfrom
FuckSelectionBrush
Closed

Use DynamicResource for TextBox SelectionBrush#4308
Jack251970 wants to merge 1 commit intodevfrom
FuckSelectionBrush

Conversation

@Jack251970
Copy link
Member

@Jack251970 Jack251970 commented Mar 1, 2026

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.


Summary by cubic

Switched the TextBox SelectionBrush in Win11Light.xaml from StaticResource to DynamicResource so the selection color updates when the accent color changes at runtime. Improves theme responsiveness and resolves #4298.

Summary of changes

  • Changed: SelectionBrush now uses DynamicResource for SystemAccentColorLight1Brush in the TextBox style.
  • Added: Automatic runtime updates to the selection color when the system accent changes.
  • Removed: StaticResource usage for SelectionBrush in the TextBox style.
  • Tests: No unit tests added; verified manually via UI behavior.
  • Security: No risks identified; UI-only style change with no data or permission impact.

Written for commit 1d39a44. 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 1, 2026 11:55
@github-actions github-actions bot added this to the 2.2.0 milestone Mar 1, 2026
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 1, 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.

@gitstream-cm
Copy link

gitstream-cm bot commented Mar 1, 2026

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

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

Updates the Windows 11 Light theme’s query TextBox selection highlight to resolve the system accent brush via DynamicResource, allowing the selection color to update automatically when Windows theme/accent resources change at runtime (addresses #4298).

Changes:

  • Switched QueryBoxStyle’s SelectionBrush from {StaticResource SystemAccentColorLight1Brush} to {DynamicResource SystemAccentColorLight1Brush}.

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

@Jack251970 Jack251970 enabled auto-merge March 1, 2026 11:57
@coderabbitai coderabbitai bot added the bug Something isn't working label Mar 1, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dda9000 and 1d39a44.

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

📝 Walkthrough

Walkthrough

Changed SelectionBrush resource binding in QueryBoxStyle from StaticResource to DynamicResource for SystemAccentColorLight1Brush, enabling runtime resource resolution instead of compile-time binding.

Changes

Cohort / File(s) Summary
Theme Resource Update
Flow.Launcher/Themes/Win11Light.xaml
Changed SelectionBrush binding from StaticResource to DynamicResource for SystemAccentColorLight1Brush, enabling runtime resource resolution during theme changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

bug

Suggested reviewers

  • taooceros
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The PR addresses issue #4298 by switching to DynamicResource, which enables runtime updates when theme/resources change; however, the fix may be incomplete as the underlying InvalidCastException appears to stem from WPF resource cloning, not just resource binding mode. Verify whether DynamicResource alone resolves the InvalidCastException during resource invalidation or if additional type checks and defensive casting are needed in the WPF resource cloning paths.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Use DynamicResource for TextBox SelectionBrush' accurately describes the main change in the PR, which switches the SelectionBrush from StaticResource to DynamicResource.
Description check ✅ Passed The description clearly explains the change (SelectionBrush switched to DynamicResource), its purpose (runtime updates to selection color), and references the linked issue #4298.
Out of Scope Changes check ✅ Passed The PR changes only the SelectionBrush resource binding mode in Win11Light.xaml, which is directly related to the theme responsiveness goal outlined in issue #4298.
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 FuckSelectionBrush

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.

@jjw24 jjw24 removed this from the 2.2.0 milestone Mar 4, 2026
@jjw24 jjw24 removed the bug Something isn't working label Mar 4, 2026
@jjw24
Copy link
Member

jjw24 commented Mar 4, 2026

Please re-submit

@jjw24 jjw24 closed this Mar 4, 2026
auto-merge was automatically disabled March 4, 2026 09:50

Pull request was closed

@Jack251970
Copy link
Member Author

Jack251970 commented Mar 4, 2026

Please re-submit

Resubmitted in #4321

Resubmitted in #4322

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.

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

3 participants