Skip to content

Conversation

@SimonZhao888
Copy link
Member

@SimonZhao888 SimonZhao888 commented Jan 19, 2026

Fixes #14210

Root Cause

ListView is the underlaying Win32 control. When it's in dark mode, the font color is highlighted, but the background color isn't set to dark, causing the items in the ListView to not display correctly. Furthermore, we cannot modify the background color using following code PInvokeCore.SendMessage(this, PInvoke.LVM_SETBKCOLOR, (WPARAM)0, (LPARAM)BackColor).

Proposed changes

  • In Dark Mode, when the ListView control is disabled (Enabled = false), the text and background colors are set so that the items can be displayed correctly.

Customer Impact

  • The ListView can display the items correctly when it is in DarkMode and setting the Enable as false.

Regression?

  • Yes

Risk

  • Min

Screenshots

Before

image

After

image

Test methodology

  • Manually

Accessibility testing

Test environment(s)

  • .net 11.0.100-alpha.1.25618.104
Microsoft Reviewers: Open in CodeFlow

@SimonZhao888 SimonZhao888 requested a review from a team as a code owner January 19, 2026 06:57
@github-actions github-actions bot added the area-DarkMode Issues relating to Dark Mode feature label Jan 19, 2026
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.17234%. Comparing base (ff0d8d0) to head (0de26b3).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #14219         +/-   ##
===================================================
+ Coverage   77.15694%   77.17234%   +0.01539%     
===================================================
  Files           3279        3279                 
  Lines         645347      645064        -283     
  Branches       47721       47723          +2     
===================================================
- Hits          497930      497811        -119     
+ Misses        143729      143560        -169     
- Partials        3688        3693          +5     
Flag Coverage Δ
Debug 77.17234% <0.00000%> (+0.01539%) ⬆️
integration 18.98921% <0.00000%> (-0.00734%) ⬇️
production 52.03647% <0.00000%> (+0.00965%) ⬆️
test 97.40560% <ø> (+0.00001%) ⬆️
unit 49.46068% <0.00000%> (-0.00505%) ⬇️

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.

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 pull request addresses issue #14210 where ListView items are not displayed correctly when the control is disabled (Enabled = false) in dark mode. The root cause is that the underlying Win32 ListView control has a light font color in dark mode but doesn't have its background color properly set to dark, making the items invisible or hard to see.

Changes:

  • Adds conditional color handling in the CustomDraw method for disabled ListViews in dark mode
  • Sets specific text and background colors to improve visibility when the control is disabled and dark mode is enabled

Copy link
Member

@ricardobossan ricardobossan left a comment

Choose a reason for hiding this comment

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

All LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-DarkMode Issues relating to Dark Mode feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dark Mode] The ListView cannot display the items when setting the Enable as false

2 participants