Fix issue 11956: [Dark Mode] CheckBox in TreeView/ListView is not in dark mode after enabled SystemColorMode.Dark#14288
Fix issue 11956: [Dark Mode] CheckBox in TreeView/ListView is not in dark mode after enabled SystemColorMode.Dark#14288SimonZhao888 wants to merge 4 commits intodotnet:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14288 +/- ##
===================================================
+ Coverage 77.22797% 77.30967% +0.08169%
===================================================
Files 3279 3265 -14
Lines 645138 644539 -599
Branches 47730 47644 -86
===================================================
+ Hits 498227 498291 +64
+ Misses 143226 142558 -668
- Partials 3685 3690 +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.
Pull request overview
Fixes WinForms dark mode rendering for TreeView/ListView checkboxes when Application.SetColorMode(SystemColorMode.Dark) is enabled, aligning checkbox visuals with other controls in dark mode.
Changes:
TreeView: generate and apply a dark-mode-aware state imagelist for checkboxes, and refresh it on handle creation,CheckBoxesenablement, andWM_SYSCOLORCHANGE.ListView: generate and apply a dark-mode-aware state imagelist for checkboxes during dark mode theme application, and refresh item state images to ensure correct visuals.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/System.Windows.Forms/System/Windows/Forms/Controls/TreeView/TreeView.cs | Adds UpdateCheckBoxImages() to supply themed checkbox state images and refresh them on relevant lifecycle/system events. |
| src/System.Windows.Forms/System/Windows/Forms/Controls/ListView/ListView.cs | Adds a dark-mode state imagelist for checkbox rendering during ApplyDarkModeOnDemand(). |
src/System.Windows.Forms/System/Windows/Forms/Controls/TreeView/TreeView.cs
Outdated
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/TreeView/TreeView.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/TreeView/TreeView.cs
Show resolved
Hide resolved
…after setting an image for a TreeView node.
c0dd9db
|
Hi @SimonZhao888, thanks for tackling the TreeView/ListView checkbox dark-mode rendering — nice work on the visual-styles approach! A few items I'd like us to address before merging:
(Copilot co-authored on Klaus' behalf.) |
Fixes #11956
Proposed changes
Fixed an issue where the checkboxes in TreeView/ListView were not rendered correctly in dark theme. The main changes are as follows:
Customer Impact
Regression?
Risk
Screenshots
Before
After
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow