Skip to content

Use DynamicResource for TextBox SelectionBrush#4321

Closed
Jack251970 wants to merge 2 commits intodevfrom
FuckSelectionBrush
Closed

Use DynamicResource for TextBox SelectionBrush#4321
Jack251970 wants to merge 2 commits intodevfrom
FuckSelectionBrush

Conversation

@Jack251970
Copy link
Member

@Jack251970 Jack251970 commented Mar 4, 2026

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


Summary by cubic

Switched the TextBox SelectionBrush in Win11Light.xaml from StaticResource to DynamicResource so the selection color updates when SystemAccentColor changes at runtime. Keeps theme responsive and continues to address issue #4298; merging dev introduces no additional behavior changes.

  • Summary of changes
    • Changed: SelectionBrush now uses DynamicResource for SystemAccentColorLight1Brush; selection color updates live with accent/theme changes.
    • Added: Runtime update behavior via dynamic resource resolution; no code-behind added.
    • Removed: Nothing removed.
    • Memory: No meaningful impact; minor resource lookup overhead, no new allocations.
    • Security: No risks; XAML-only change.
    • Tests: No unit tests added; manually verified per BUG: Unable to cast object of type 'System.Windows.Media.Color' to type 'System.Windows.Expression' #4298.

Written for commit 7eed3aa. 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 09:53
@github-actions github-actions bot added this to the 2.2.0 milestone Mar 4, 2026
@Jack251970 Jack251970 enabled auto-merge March 4, 2026 09:54
@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.

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 TextBox styling so the selection highlight brush tracks system accent resource changes at runtime, addressing the crash reported when Windows theme resources are refreshed (issue #4298).

Changes:

  • Switched TextBox.SelectionBrush in the Win11Light theme from {StaticResource ...} to {DynamicResource ...} so it re-resolves when system resources change.

💡 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: 1c1cba26-b9a9-4c79-b5aa-7647efe875d8

📥 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

Changes the QueryBoxStyle SelectionBrush in the Win11Light theme from a StaticResource reference to a DynamicResource reference, enabling runtime resolution of system theme resources instead of static initialization.

Changes

Cohort / File(s) Summary
Win11 Light Theme Resources
Flow.Launcher/Themes/Win11Light.xaml
Updated QueryBoxStyle SelectionBrush from StaticResource to DynamicResource for SystemAccentColorLight1Brush to support dynamic theme updates at runtime.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

bug

Suggested reviewers

  • jjw24
  • onesounds
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The PR partially addresses issue #4298 by switching to DynamicResource, which should enable runtime resource updates; however, the fix only targets the QueryBoxStyle and may not fully resolve the root cause of the InvalidCastException across all affected styles. Verify that the DynamicResource change resolves the InvalidCastException when themes are applied. If crashes persist in other styles, identify and fix all similar StaticResource references causing the cast failure.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change—switching SelectionBrush from StaticResource to DynamicResource in the TextBox style to resolve the linked issue.
Description check ✅ Passed The description is relevant and explains the change, including the linked issue reference and testing validation from the issue participants.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to only the QueryBoxStyle SelectionBrush in Win11Light.xaml, which aligns with the issue requirements of making the resource update dynamically.
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.

@Jack251970 Jack251970 closed this Mar 4, 2026
auto-merge was automatically disabled March 4, 2026 10:39

Pull request was closed

@Jack251970 Jack251970 deleted the FuckSelectionBrush branch March 4, 2026 10:39
@Jack251970 Jack251970 removed the bug Something isn't working label Mar 4, 2026
@Jack251970 Jack251970 removed this from the 2.2.0 milestone Mar 4, 2026
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.

2 participants