Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

Proposed changes

  • Changed selected item text color in CollectionEditor.CollectionEditorCollectionForm to use SystemColors.ControlText in dark mode instead of SystemColors.HighlightText
  • Applied pattern consistent with CheckedListBox dark mode handling

Customer Impact

  • Collection Editor dialogs (TabPage, ToolStrip, ListView, DataGridView, etc.) now display readable text in dark mode
  • Fixes 3.145:1 contrast ratio failure (dark blue #2C62B2 on near-black #000C39) to compliant contrast

Regression?

No

Risk

Low - single line change following established pattern, affects only dark mode rendering

Screenshots

Before

Text invisible due to poor contrast in dark mode:

Before

After

image image

Text visible with proper contrast (pending manual verification)

Test methodology

  • Code review: passed with no comments
  • CodeQL security scan: no issues
  • Pattern matches CheckedListBox.cs implementation
  • Manual testing required: create WinForms app with TabControl + PropertyGrid, set Application.SetColorMode(SystemColorMode.Dark), verify text visibility in Collection Editor

Accessibility testing

Manual accessibility testing required post-build to verify WCAG AA contrast compliance.

Test environment(s)

  • .NET 10.0

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • rcxvsblobprodcus328.vsblob.vsassets.io
    • Triggering command: /home/REDACTED/work/winforms/winforms/.dotnet/dotnet /home/REDACTED/work/winforms/winforms/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/winforms/winforms/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/winforms/winforms/artifacts/toolset/11.0.0-beta.25609.108.txt (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Dark Mode] the text of button of List Item does not display in the TabPage Collection Editor dialog</issue_title>
<issue_description>### .NET version

latest .NET 10.0 build

Did it work in .NET Framework?

No

Did it work in any of the earlier releases of .NET Core or .NET 5+?

The issue also can reproduce .NET 9.0

Issue description

The text of button of List Item does not display in the TabPage Collection Editor dialog, and the text is insufficient contrast for focused items

Image

Steps to reproduce

  1. Create a .NET winforms project with PropertyGrid & TabControl controls
  2. Select the tabContorl1 as object for the propertyGrid1
  3. Set app under Dark mode in program.cs file
    Application.SetColorMode(SystemColorMode.Dark);
  4. Run the application
  5. Open the TabPage Collection Editor dialog, and select the items

More info:

  1. The issue can reproduce all controls which support open the collection editor dialog via PropertyGrid control.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Microsoft Reviewers: Open in CodeFlow

Copilot AI changed the title [WIP] Fix button text display in TabPage Collection Editor dialog Fix dark mode text visibility in Collection Editor dialogs Dec 10, 2025
Copilot AI requested a review from SimonZhao888 December 10, 2025 10:16
@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.15258%. Comparing base (ceb6911) to head (07d2df9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #14129         +/-   ##
===================================================
- Coverage   77.15337%   77.15258%   -0.00079%     
===================================================
  Files           3279        3279                 
  Lines         645325      645329          +4     
  Branches       47720       47721          +1     
===================================================
- Hits          497890      497888          -2     
- Misses        143748      143750          +2     
- Partials        3687        3691          +4     
Flag Coverage Δ
Debug 77.15258% <0.00000%> (-0.00079%) ⬇️
integration 18.98572% <0.00000%> (-0.00827%) ⬇️
production 52.01439% <0.00000%> (-0.00143%) ⬇️
test 97.40749% <ø> (ø)
unit 49.46814% <0.00000%> (+0.01216%) ⬆️

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.

@dotnet-policy-service dotnet-policy-service bot added the draft draft PR label Dec 10, 2025
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

This PR fixes dark mode text visibility issues in Collection Editor dialogs by changing the selected item text color from SystemColors.HighlightText to SystemColors.ControlText when dark mode is enabled, following the established pattern from CheckedListBox.

Key changes:

  • Modified text color selection logic to use SystemColors.ControlText in dark mode for better contrast
  • Applied WFO5001 pragma suppression consistent with other dark mode implementations

Comment on lines 582 to 585
using (SolidBrush backBrush = new(backColor))
{
g.FillRectangle(backBrush, button);
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary? In most cases, adjusting the text color alone is enough to ensure proper contrast in dark mode.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, actually the text color is highlight, but backcolor of the button is light color,this caused the text of button can't see clearly, so I adjust backcolor of the button

{
backColor = SystemColors.Highlight;
textColor = SystemColors.HighlightText;
#pragma warning disable WFO5001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
Copy link
Member

Choose a reason for hiding this comment

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

The "Disable warning" option here should no longer be necessary.

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment on lines +577 to +580
using (SolidBrush backBrush = new(SystemColors.Window))
{
g.FillRectangle(backBrush, button);
}
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

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

Should use modern 'using var' declaration style instead of the traditional using statement block. This reduces nesting and improves readability per the coding guidelines. Change to 'using SolidBrush backBrush = new(SystemColors.Window);' and remove the braces, moving the FillRectangle call outside.

Copilot generated this review using guidance from repository custom instructions.
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.

[Dark Mode] the text of button of List Item does not display in the TabPage Collection Editor dialog

4 participants