Repository navigation
Fix CheckBox and RadioButton with Appearance.Button and FlatStyle.Standard do not use the system accent color when checked in Dark Mode - #15166
Open
JayashreeSF3546 wants to merge 8 commits into
Conversation
…d do not use the system accent color when checked in Dark Mode
…winforms into Fix_Issue_15126
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15166 +/- ##
=============================================
Coverage 37.84861% 37.84861%
=============================================
Files 246 246
Lines 9789 9789
Branches 1031 1031
=============================================
Hits 3705 3705
Misses 5920 5920
Partials 164 164
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
This PR fixes accent-color rendering for checked Appearance.Button controls in dark .NET 11 visual styles.
Changes:
- Enables owner-drawn rendering for affected CheckBox and RadioButton controls.
- Preserves checked appearance during hover.
| File | Description |
|---|---|
| src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/RadioButton.cs | Updated as part of this pull request. |
| src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/CheckBox.cs | Updated as part of this pull request. |
| src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/ButtonInternal/DarkMode/ButtonDarkModeAdapter.cs | Updated as part of this pull request. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #15126
Proposed changes
CheckBoxandRadioButtoncontrols configured withAppearance.ButtonandFlatStyle.Standardin Dark Mode when the effective visual styles mode isVisualStylesMode.Net11or later.FlatStyle.System.Customer Impact
CheckBoxandRadioButtoncontrols usingAppearance.ButtonandFlatStyle.Standardnow use the system accent color in .NET 11 Dark Mode.FlatStyle.Systemrendering remain unchanged.Regression?
Risk
Appearance.Button,FlatStyle.Standard, andVisualStylesMode.Net11or later.FlatStyle.Systemremains native-rendered and does not guarantee use of the WinForms accent palette.Screenshots
Before
After
Test methodology
CheckBoxandRadioButtonwithAppearance.Buttonin Dark Mode usingVisualStylesMode.Net11.FlatStyle.Standard,FlatStyle.Flat,FlatStyle.Popup, andFlatStyle.System.FlatStyle.Standarduses the system accent color for the checked state and retains the checked appearance during hover.FlatStyle.Systemcontinues to use native Windows rendering and is intentionally unaffected by the owner-drawn accent palette.Accessibility testing
CheckBoxandRadioButtoncontrols.Test environment(s)
Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow