[release/11.0] Enable DataGridView dark mode theming via AppContext switch - #15073
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[release/11.0] Enable DataGridView dark mode theming via AppContext switch#15073github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
## Proposed changes - Introduce an AppContext quirk switch `System.Windows.Forms.DataGridViewDarkModeTheming` (exposed via LocalAppContextSwitches / AppContextSwitches) to control whether DataGridView uses dark-mode-specific theming, defaulting to **enabled** for .NET 10 and allowing apps to opt out. - Add `ApplyDarkModeTheming` in DataGridView and call it only when dark mode is active and the new switch is enabled, centralizing the dark palette (background, gridlines, header/row colors) for high contrast on dark backgrounds. - Update DataGridView painting logic for several cell types—core cells, checkbox cells, combo box cells, and column header cells (**sort glyphs**)—to use adjusted colors and rendering that remain legible and visually correct in dark mode. - Improve DataGridViewLinkCell in dark mode by using shared `LinkUtilities` link colors (aligned with LinkLabel’s dark colors) and ensuring selected links render with appropriate selection foreground color for sufficient contrast. - Keep existing light-mode/legacy behavior unchanged when the AppContext switch is disabled, so existing applications can retain their current appearance without code changes. ## Customer Impact - Users get a DataGridView that automatically renders with readable, high-contrast colors in dark mode by default, while app developers can still opt out via an AppContext switch to preserve existing light-themed behavior if needed.
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.
Backport of #14267 to release/11.0
Fixes bug #14266
Proposed changes
Customer Impact
Testing
Risk
Regression?