-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix issue 14210: [Dark Mode] The ListView cannot display the items when setting the Enable as false #14219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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
src/System.Windows.Forms/System/Windows/Forms/Controls/ListView/ListView.cs
Show resolved
Hide resolved
src/System.Windows.Forms/System/Windows/Forms/Controls/ListView/ListView.cs
Show resolved
Hide resolved
src/System.Windows.Forms/System/Windows/Forms/Controls/ListView/ListView.cs
Show resolved
Hide resolved
src/System.Windows.Forms/System/Windows/Forms/Controls/ListView/ListView.cs
Show resolved
Hide resolved
src/System.Windows.Forms/System/Windows/Forms/Controls/ListView/ListView.cs
Show resolved
Hide resolved
ricardobossan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All LGTM!
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
Customer Impact
Regression?
Risk
Screenshots
Before
After
Test methodology
Accessibility testing
Test environment(s)
Microsoft Reviewers: Open in CodeFlow