Fix ComboBox drop-down button incorrectly uses BackColor - #14861
Open
LeafShi1 wants to merge 2 commits into
Open
Fix ComboBox drop-down button incorrectly uses BackColor#14861LeafShi1 wants to merge 2 commits into
LeafShi1 wants to merge 2 commits into
Conversation
LeafShi1
requested review from
KlausLoeffelmann,
SimonZhao888 and
ricardobossan
August 6, 2026 08:05
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the NET11 modern ComboBox renderer so the drop-down button no longer picks up the control’s BackColor, aligning the visual behavior more closely with Classic mode expectations (custom field background without tinting the button chrome).
Changes:
- Switch drop-down button rendering to use a fixed “base” surface color instead of
GetEffectiveBackColor(comboBox). - Add a helper (
GetDropDownButtonBaseColor) that selects a system-derived base color (with a dark-mode variant).
Suppressed comments (1)
src/System.Windows.Forms/System/Windows/Forms/Controls/ComboBox/ComboBox.ModernComboAdapter.cs:208
- This change alters rendering behavior (drop-down button background no longer derives from ComboBox.BackColor), but there doesn’t appear to be a regression test asserting the button region ignores a custom BackColor under VisualStylesMode.Net11. There are already bitmap-based tests in ComboBoxTests.cs for modern adapter rendering, so adding a similar test (sampling pixels within _buttonBounds) would help prevent regressions of #14849.
Color background = GetDropDownButtonBaseColor(comboBox);
Color buttonColor = comboBox._mousePressed
? PopupButtonColorMath.Blend(
background,
Application.SystemVisualSettings.AccentColor,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
SimonZhao888
approved these changes
Aug 6, 2026
Member
|
Looks good to me! |
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 #14849
Root Cause
The NET11 ModernComboAdapter treated ComboBox.BackColor as the base color for the drop-down button. As a result, assigning a custom field background also tinted the button, unlike Classic mode where the button remains system-rendered.
Proposed changes
ComboBoxrenderer so the drop-down button no longer derives its surface color fromComboBox.BackColor.Customer Impact
BackColorcustomizes only the editable field, the drop-down button retains a neutral system appearance.Regression?
Risk
Screenshots
Before
Editable field and drop-down button both use/tint from
BackColor.After
Only the editable field uses
BackColor, the drop-down button retains neutral system chrome.DarkMode:

Light mode:

Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow