Sitelet https://github.com/dotnet/winforms/pull/15166
Skip to content

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
dotnet:mainfrom
JayashreeSF3546:Fix_Issue_15126
Open

JayashreeSF3546 wants to merge 8 commits into
dotnet:mainfrom
JayashreeSF3546:Fix_Issue_15126

Conversation

@JayashreeSF3546

@JayashreeSF3546 JayashreeSF3546 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15126

Proposed changes

  • Use the owner-drawn rendering path for CheckBox and RadioButton controls configured with Appearance.Button and FlatStyle.Standard in Dark Mode when the effective visual styles mode is VisualStylesMode.Net11 or later.
  • Preserve the existing native rendering behavior for legacy visual styles and FlatStyle.System.
  • Preserve the checked visual state while the pointer is over the control, allowing the system accent color to remain applied during hover.

Customer Impact

  • Checked CheckBox and RadioButton controls using Appearance.Button and FlatStyle.Standard now use the system accent color in .NET 11 Dark Mode.
  • The checked accent appearance is retained when the pointer moves over the control. Legacy visual-style behavior and native FlatStyle.System rendering remain unchanged.

Regression?

  • No

Risk

  • Low. The owner-draw behavior change is limited to Dark Mode with Appearance.Button, FlatStyle.Standard, and VisualStylesMode.Net11 or later.
  • Legacy visual-style modes continue to use the existing native rendering path.
  • FlatStyle.System remains native-rendered and does not guarantee use of the WinForms accent palette.

Screenshots

Before

image

After

image

Test methodology

  • Tested CheckBox and RadioButton with Appearance.Button in Dark Mode using VisualStylesMode.Net11.
  • Tested checked, unchecked, and pointer-hover states with FlatStyle.Standard, FlatStyle.Flat, FlatStyle.Popup, and FlatStyle.System.
  • Verified that FlatStyle.Standard uses the system accent color for the checked state and retains the checked appearance during hover.
  • Verified that FlatStyle.System continues to use native Windows rendering and is intentionally unaffected by the owner-drawn accent palette.
  • Verified that legacy visual-style modes retain their existing rendering behavior.
  • Verified that Light Mode behavior remains unchanged.

Accessibility testing

  • Run Accessibility Insights Fast Pass against the affected CheckBox and RadioButton controls.
  • Verify that the change introduces no accessibility failures or regressions.
  • Attach the Accessibility Insights passing result and the corresponding UI snapshot here.

Test environment(s)

  • Windows 11
  • .NET SDK: 11.0.100-rc.1.26420.103
Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow

@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 37.84861%. Comparing base (799c47a) to head (991f764).

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           
Flag Coverage Δ
Debug 37.84861% <ø> (ø)
production 40.04608% <ø> (ø)
test 20.64923% <ø> (ø)
unit 40.04608% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Medium severity · 1 Low severity

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.

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.

CheckBox and RadioButton with Appearance.Button and FlatStyle.Standard do not use the system accent color when checked in Dark Mode

2 participants