Enable dark mode for TreeView and ListView mouse tooltips - #14889
Open
LeafShi1 wants to merge 1 commit into
Open
Enable dark mode for TreeView and ListView mouse tooltips#14889LeafShi1 wants to merge 1 commit into
LeafShi1 wants to merge 1 commit into
Conversation
LeafShi1
requested review from
KlausLoeffelmann,
SimonZhao888 and
ricardobossan
and
a lite review from Copilot
August 13, 2026 08:24
Contributor
There was a problem hiding this comment.
Pull request overview
Enables dark-mode theming for the native (mouse-hover) tooltip windows used by TreeView and ListView, aligning their appearance with existing dark-mode support for the controls and managed keyboard tooltips.
Changes:
TreeView: retrieves the native tooltip HWND viaTVM_GETTOOLTIPSand applies theDarkMode_Explorertheme when dark mode is enabled.ListView: retrieves the native tooltip HWND viaLVM_GETTOOLTIPSand applies theDarkMode_Explorertheme when dark mode is enabled.
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 | Applies dark-mode theme to the TreeView native tooltip handle during handle creation. |
| src/System.Windows.Forms/System/Windows/Forms/Controls/ListView/ListView.cs | Applies dark-mode theme to the ListView native tooltip handle during on-demand dark mode application. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+2026
to
+2038
| if (Application.IsDarkModeEnabled && DarkModeRequestState is true) | ||
| { | ||
| HWND toolTipHandle = (HWND)PInvokeCore.SendMessage( | ||
| this, | ||
| PInvoke.TVM_GETTOOLTIPS, | ||
| (WPARAM)0, | ||
| (LPARAM)0); | ||
|
|
||
| PInvoke.SetWindowTheme( | ||
| toolTipHandle, | ||
| $"{DarkModeIdentifier}_{ExplorerThemeIdentifier}", | ||
| null); | ||
| } |
Comment on lines
+4696
to
+4707
| // Apply dark mode theme to the ListView Tooltip | ||
| HWND toolTipHandle = (HWND)PInvokeCore.SendMessage( | ||
| this, | ||
| PInvoke.LVM_GETTOOLTIPS, | ||
| (WPARAM)0, | ||
| (LPARAM)0); | ||
|
|
||
| PInvoke.SetWindowTheme( | ||
| toolTipHandle, | ||
| $"{DarkModeIdentifier}_{ExplorerThemeIdentifier}", | ||
| null); | ||
|
|
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 #14878
Root Cause
TreeView and ListView use native tooltip windows for mouse-hover tooltips. Dark mode was applied to the controls themselves and to managed keyboard tooltips, but not to these native tooltip windows.
Proposed changes
TVM_GETTOOLTIPSandLVM_GETTOOLTIPS, then apply theDarkMode_Explorertheme when dark mode is enabled for the control.Customer Impact
Regression?
Risk
Screenshots
Before
With
SystemColorMode.Darkenabled, mouse-hover tooltips for TreeView and ListView were rendered using the light theme. Keyboard tooltips were already rendered in dark mode.After
Mouse-hover and keyboard tooltips for TreeView and ListView are consistently rendered in dark mode when SystemColorMode.Dark is enabled.
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow