-
Notifications
You must be signed in to change notification settings - Fork 1k
DarkMode (b) DarkModeButtonRenderer #13408
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
Open
KlausLoeffelmann
wants to merge
9
commits into
dotnet:klaus/preview5/A
Choose a base branch
from
KlausLoeffelmann:DarkMode_b_DarkModeButtonRenderer
base: klaus/preview5/A
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
DarkMode (b) DarkModeButtonRenderer #13408
KlausLoeffelmann
wants to merge
9
commits into
dotnet:klaus/preview5/A
from
KlausLoeffelmann:DarkMode_b_DarkModeButtonRenderer
Conversation
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
57f4d2f
to
3b45170
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13408 +/- ##
===================================================
- Coverage 76.60074% 76.48147% -0.11928%
===================================================
Files 3230 3239 +9
Lines 639097 640227 +1130
Branches 47289 47402 +113
===================================================
+ Hits 489553 489655 +102
- Misses 145962 146996 +1034
+ Partials 3582 3576 -6
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
c2e7374
to
2530362
Compare
918e60d
to
b83e93b
Compare
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.
Add a
DarkModeButton
Renderer based on our existingButtonFlatRenderer
.This way, we are getting completely independing of the XP-based VisualStyle rendering (and most of all incomplete theming for certain situations, like the Button rendering for 96DPI/100% scaling scenarios).
Fixes #11949.
Note:
The current DarkMode PRs need to be tested as a whole, so they are always rebased on each other, hence the "sorting" letters in the PR titles.
Since each of them carries from a review point of view every change of also of the one, the respective next is based on, I pushed also the "based-on PRs" as branches to the main repo, and had GitHub the PRs to review based on them, so you will ONLY see the changes for that particular PR.
Approach
TL;DR
Four sub-renderers are needed to faithfully reproduce the visual and interactive nuances of each FlatStyle in dark mode, ensuring both compatibility and a polished user experience.
The
ButtonDarkModeRenderer
is designed to render buttons with a modern, dark-themed appearance, while preserving the flexibility and compatibility required by the classic WinForms Button control. It achieves this by abstracting the rendering logic into a set of interchangeable renderer classes, each tailored to a specific FlatStyle.Why Four Different Sub-Renderers?
WinForms Button supports four
FlatStyle
values, each with distinct visual and behavioral requirements. It was the goal, to find appropriate equivalents for each style in dark mode.Each style has unique needs for borders, backgrounds, focus cues, and interaction feedback. To provide accurate dark mode support for all these styles, the renderer system uses four sub-renderers classes:
StandardButtonDarkModeRenderer
Handles the default look, with subtle visual effects for Mouse hover and click.
FlatButtonDarkModeRenderer
Renders a border-only button, with minimal effects and minimal background coloring, matching the original, minimalistic flat style.
PopupButtonDarkModeRenderer
Provides a subtle 3D effect with rounded corners and shadow/highlight borders, suitable for popup-style buttons.
SystemButtonDarkModeRenderer
Mimics the Fluent Style for WPF and how WinUI renders Buttons.
CodeFlow
ButtonDarkModeRenderer
selects the appropriate sub-renderer based on the button’s FlatStyle.IButtonDarkModeRenderer
) with methods for drawing the background, focus indicator, and determining text color.Summary Table
StandardButtonDarkModeRenderer
FlatButtonDarkModeRenderer
PopupButtonDarkModeRenderer
SystemButtonDarkModeRenderer
Microsoft Reviewers: Open in CodeFlow