Skip to content

[release/11.0] Backport RC2 integration changes into release/11.0 - #15143

Merged
KlausLoeffelmann merged 32 commits into
dotnet:release/11.0from
LeafShi1:Backport-RC2-changes-to-release/11.0
Sep 21, 2026
Merged

KlausLoeffelmann merged 32 commits into
dotnet:release/11.0from
LeafShi1:Backport-RC2-changes-to-release/11.0

Conversation

@LeafShi1

@LeafShi1 LeafShi1 commented Sep 18, 2026

Copy link
Copy Markdown
Member

Description

Backport the selected .NET 11 Visual Styles fixes to release/11.0 for RC2.

This PR consolidates the following previously reviewed fixes into a single backport:

Customer Impact

  • Without these fixes, applications using the .NET 11 Visual Styles may encounter rendering, layout, color, RTL, and design-time issues across several WinForms controls, including TextBox, ComboBox, Button, CheckBox, RadioButton, GroupBox, and ToggleSwitch.
    The changes also prevent NET11 VisualStylesMode from being applied to composite controls that are not yet ready for the new visual style behavior.
  • The design-time analyzer guardrails detect unsupported Designer-generated code patterns that can break designer loading or serialization, and provide actionable guidance without changing application runtime behavior. Individual diagnostics remain configurable.

Regression

Most of the changes in this backport address regressions or incorrect behavior identified during .NET 11 Visual Styles development and validation.

#15113 introduces the updated per-state border styling for editable controls as part of the .NET 11 Visual Styles. The remaining changes fix rendering, layout, color, RTL, and design-time issues related to the new visual styles.

#15163 does not address a shipped runtime regression. It introduces design-time analyzer guardrails and includes fixes for analyzer false positives, missed cases, and VB analyzer exceptions identified during development.

The individual changes have been reviewed and validated in their original PRs, and the selected changes were also tested before this backport.

Testing

Each fix includes its corresponding tests and validation from the original PR.

The selected fixes were also tested together to validate the combined RC2 changes before backporting them to release/11.0.

Risk

Medium. - The primary risk is in WinForms control rendering and layout under the .NET 11 Visual Styles, along with the newly added design-time analyzer behavior. This backport includes both visual-style fixes and an intentional visual behavior change for editable-control borders introduced by #15113.

The affected areas include:

  • Editable control border rendering and state-specific border styling.
  • CheckBox and RadioButton colors, glyphs, and background rendering.
  • RTL layout for RadioButton and ToggleSwitch.
  • GroupBox background, color inheritance, and child-control rendering.
  • Button focus indicator rendering.
  • ComboBox layout and rendering.
  • Text layout and clipping in editable controls.
  • VisualStylesMode behavior at design time.
  • VisualStylesMode availability for composite controls.
  • Design-time analyzer diagnostics. Some diagnostics are enabled as errors by default and can fail builds containing unsupported Designer-generated code. The diagnostics remain individually configurable.

The individual changes have been reviewed and validated in their original PRs, and the combined changes were tested together before this backport.

Fix

Backport the selected .NET 11 Visual Styles changes for RC2, including:

  • Introduce the new per-state border styling for editable controls.
  • Fix editable-control border colors and text rendering.
  • Fix CheckBox, RadioButton, and ToggleSwitch rendering, including RTL scenarios.
  • Fix GroupBox background rendering and inherited colors.
  • Fix Button focus indicator rendering.
  • Fix ComboBox layout and rendering.
  • Fix VisualStylesMode configuration in the Properties window.
  • Disable NET11 VisualStylesMode for composite controls that are not yet ready for the new visual styles.
  • Adds design-time analyzer guardrails and the shared analyzer test infrastructure

KlausLoeffelmann and others added 30 commits September 14, 2026 20:46
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: fd23f197-6fd3-48ef-bec0-8c12fb54c30c
## Summary

Restores the Azure DevOps branch filters for `integration/11.0-RC2`
after rebuilding the branch from its correct continuous base,
`release/11.0`.

This enables:

- PR validation through `azure-pipelines-PR.yml`
- completed-check-in CI through `azure-pipelines-PR.yml`
- official post-check-in builds through `azure-pipelines.yml`

This is the first PR in the corrected RC2 integration replay chain.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15097)
Proposed changes
Introduce shared editable-control border color logic in ModernControlColorMath and use it across NET11 editable renderers.

Uses a stable border color instead of ForeColor.
Applies the shared border color to TextBoxBase, ComboBox.ModernComboAdapter, and UpDownBase.
Uses a visible dark-mode border color.
Customer Impact
Customers using VisualStylesMode.Net11 can customize editable-control text colors without unintentionally changing the control border.
…l styles (dotnet#15098)

Replays dotnet#14853 onto the corrected `integration/11.0-RC2` branch based on
`release/11.0`.

This is prerequisite 1 of 11 in the ordered RC2 integration chain.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15098)
## Proposed changes

- Added DPI-aware glyph padding in `RadioButtonModernAdapter`, preventing RTL hover clipping
- Added regression coverage in `RadioButtonTests`

<!-- We are in TELL-MODE the following section must be completed -->

## Customer Impact

- RadioButton glyphs now render correctly without clipping when using `RightToLeft.Yes` with .NET 11 visual styles, including during mouse hover. The change also respects DPI scaling.
…outs (dotnet#15099)

Replays dotnet#14904 onto the corrected `integration/11.0-RC2` branch based on
`release/11.0`.

This is prerequisite 2 of 11 in the ordered RC2 integration chain.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15099)
…net#14910)

Modern GroupBox renderers painted opaque surfaces over `BackgroundImage`. Additionally:
- Clipped regions recalculated image layout, making Header and Body appear as separate images.
- Flat style only repainted the caption background.
- Popup used an opaque accent Header.
- System style exposed its background image when child controls requested the parent background.
- Rounded child controls painted a solid `Parent.BackColor` mitigation outline, causing white halos over image backgrounds.

- Render Standard, Flat, and Popup background images using one shared client-coordinate image.
- Use graphics clipping without recalculating image layout.
- Apply a subtle dark shade to the Standard Body to preserve Header/Body separation.
- Blend the Popup Header with the system accent color at 50% opacity.
- Prevent System GroupBox images from leaking into child-control backgrounds.
- Skip solid rounded-border mitigation when the parent has a background image.
- Add pixel-based regression tests for image continuity, overlays, System behavior, and rounded-control edges.
…11 visual styles (dotnet#15100)

Replays dotnet#14910 onto the corrected `integration/11.0-RC2` branch based on
`release/11.0`.

This is prerequisite 3 of 11 in the ordered RC2 integration chain.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15100)
…alues in VisualStylesMode.Net11 (dotnet#14865)

* Fix issue 14859: CheckBox and RadioButton ignore explicit BackColor values in VisualStylesMode.Net11

* Sync the latest code and apply relevant fixes.

* Handle feedback

---------

Co-authored-by: Simon Zhao (BEYONDSOFT CONSULTING INC) <v-weidzh@microsoft.com>
…d RadioButton (dotnet#15101)

Replays dotnet#14865 onto the corrected `integration/11.0-RC2` branch based on
`release/11.0`.
…accent-colored focus indicator with VisualStylesMode = NET11 (dotnet#14860)

* Fix issue 14772: Button hosted on a TabPage does not use the Windows accent-colored focus indicator with VisualStylesMode = NET11

* Handle feedback

---------

Co-authored-by: Simon Zhao (BEYONDSOFT CONSULTING INC) <v-weidzh@microsoft.com>
…s accent color as the focus indicator (dotnet#15103)

Replays dotnet#14860 onto the corrected
integration/11.0-RC2 branch based on release/11.0.

This is prerequisite 5 of 11 in the ordered RC2 integration chain.
…ly and displays an unexpected vertical scrollbar (dotnet#14827)

* Fix issue 14795: ComboBox with DropDownStyle.Simple renders incorrectly and displays an unexpected vertical scrollbar

* Handle feedback

* Handle feedback

* Fix test case feedback

* Handle feedback

---------

Co-authored-by: Simon Zhao (BEYONDSOFT CONSULTING INC) <v-weidzh@microsoft.com>
…yle.Simple (dotnet#15104)

Replays dotnet#14827 onto the corrected integration/11.0-RC2 branch based on
release/11.0.

This is prerequisite 6 of 11 in the ordered RC2 integration chain.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15104)
…net#15019)

## Proposed changes

- Only remove the local override when `VisualStylesMode.Inherit` is explicitly assigned. Preserve explicitly assigned values even when they currently match the parent. 

## Customer Impact

- Customers can configure `VisualStylesMode` as `Classic` through the Visual Studio Properties window. Explicit values also remain stable if the parent’s visual styles mode later changes.
…rit to Classic in Properties Window (dotnet#15105)

Replays dotnet#15019 onto the corrected integration/11.0-RC2 branch based on
release/11.0.

This is prerequisite 7 of 11 in the ordered RC2 integration chain.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15105)
…as obscured at the bottom. (dotnet#14887)

* Improve Net11 TextBox text layout by reducing excess vertical whitespace
* Handling the issue of incomplete text display for TextBox and NumericUpDown controls under different scaling settings.
* Adjust the height of the ComboBox control in .NET 1.1.
* Adjusting the radian angle of a text box in Net11 mode
* Adjust the outer border length of controls like UpDown to minimize the native TextBox's impact on the border.
* Handle the failed test cases
* Handle Copilot feedback
* Ensure the borders of Net11 Modern rounded-corner controls remain thinner and more consistent across common DPI settings, mitigating the visual issue where rounded corners appear thicker than straight lines.
* Handle failure test cases
* Increase the bottom height of textbox when the control is focused.
* The height of controls like Edit in Net11 mode has been readjusted so that it is no longer the same as the height of controls in Classic mode.
* Adjust the size of the DataGridViewComboBoxCell; adjust the size of the UpDown control buttons.
* Fixed an issue where text was obscured at certain scales.
* Remove empty line
* Fixed the issue of inconsistent height of ComboBox when DropDownStyle=DropDown and DropDownList.
* Fixed an issue where the initial horizontal scroll position was incorrect at 350% DPI, causing the first character to be cut off.
* Handle conflicts
* Fix issue: ComboBox text appears vertically misaligned in DropDown mode, repro on all DPI values: 100%DPI ~ 300%DPI
* Remove DataGridView related fixes
* Handle failure test case
* Handle conflicts

---------

Authored-by: Simon Zhao (BEYONDSOFT CONSULTING INC) <v-weidzh@microsoft.com>
…omboBox controls (dotnet#15106)

Replays dotnet#14887 onto the corrected integration/11.0-RC2 branch based on
release/11.0.

This is prerequisite 8 of 11 in the ordered RC2 integration chain.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15106)
… ForeColor/BackColor updates in VisualStylesMode.Net11 (dotnet#14929)

* Fix issue 14778: Controls inside GroupBox no longer reflect inherited ForeColor/BackColor updates in VisualStylesMode.Net11
* Handle copilot feedback
* Handle feedback
* Handle conflicts

---------

Co-authored-by: Simon Zhao (BEYONDSOFT CONSULTING INC) <v-weidzh@microsoft.com>
…r controls in GroupBox under VisualStylesMode.Net11 (dotnet#15108)

Replays dotnet#14929 onto the corrected integration/11.0-RC2 branch based on
release/11.0.

This is prerequisite 9 of 11 in the ordered RC2 integration chain.

###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15108)
…n RightToLeft is enabled and AutoSize is false (dotnet#14815)

* Fix issue 14808: CheckBox/RadioButton: ToggleSwitch overlaps text when RightToLeft is enabled and AutoSize is false
* Fixed the issue where images were being cut.
* Handle feedback
* Fix the test issue
* Optimize the code
* Update character encoding from UTF-8-BOM to UTF-8.
* Handle feedback

Authored by Simon Zhao (BEYONDSOFT CONSULTING INC) <v-weidzh@microsoft.com>
Reintroduces the state-specific field-outline work from dotnet#15080 on top of integration/11.0-RC2 for dotnet#14906. The change brings back the per-state stroke selection and linear-light color calculations across TextBoxBase, the modern ComboBox adapter, and UpDownBase, along with the tapered focus cue on the lower edge, hover rendering, and a sharp one-pixel bottom border for FixedSingle and None.

Adjusts the ComboBox disabled-border unit coverage for the updated muted enabled border. The test now verifies that the enabled field-stroke color is not present in the disabled image and that the disabled image uses the disabled border color, since comparing enabled and disabled pixel totals no longer separates the states once the enabled border is also a subtle gray.
…ft is enabled and AutoSize is false (dotnet#15110)

Replays dotnet#14815 onto the corrected integration/11.0-RC2 branch based on
release/11.0.

This is prerequisite 10 of 11 in the ordered RC2 integration chain.
…s (ToolStrip, DataGridView, etc.) until NET11 layout modernization is completed (dotnet#15033)

## Proposed changes

- Fall back to Classic rendering for ToolStrip, MenuStrip, and DataGridView when Net11 visual styles are requested.
- Add AppContext switches to opt these controls into Net11 rendering:

>  -  System.Windows.Forms.ToolStripModernRendering
>  -  System.Windows.Forms.DataGridViewModernRendering

- Preserve visual-style inheritance and change-notification behavior for coerced modes.

## Customer Impact

- ToolStrip, MenuStrip, and DataGridView use stable Classic rendering by default until their Net11 layout modernization is complete.
- Applications can opt into Net11 rendering through the corresponding AppContext switches.
- Existing applications retain their current behavior unless explicitly opted in.
…trols (dotnet#15114)

Replays dotnet#15033 onto the corrected integration/11.0-RC2 branch based on
release/11.0.

This is prerequisite 11 of 11 in the ordered RC2 integration chain.

###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15114)
## Summary

This is the integration/11.0-RC2 version of dotnet#15080 so the state-aware
field outlines can be exercised against the RC2 branch. The needed code
dependencies are already present on this branch.

## What changed

This PR restores the per-state editable-control border model for dotnet#14906
on integration/11.0-RC2. It applies the state-based stroke resolver and
linear-light color blending to TextBoxBase, the modern ComboBox adapter,
and UpDownBase, keeps the bottom-edge focus cue tapered, restores hover
behavior, and preserves a clean one-pixel bottom edge for FixedSingle
and None.

The ComboBox disabled-border test was also revised for the new
low-contrast enabled border. Instead of relying on an
enabled-versus-disabled pixel-count difference, it now checks that the
enabled field-stroke color is absent from the disabled rendering and
that the disabled rendering uses the disabled border color.

## Testing

The updated ComboBox disabled-border test passes locally on an
equivalent base for all three FlatStyle cases. Integration CI will
provide the RC2 runtime confirmation.

## Refs

Related to dotnet#14906. This re-lands the intent of dotnet#15080 for
integration/11.0-RC2, while the main-first landing remains tracked
separately by dotnet#15109.

###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15113)
The Net11 UpDown focus edge used 3 DIP instead of 2 DIP.
Use 2 DIP in UpDownBase.cs while retaining the shared edge geometry.
This puts the UpDown focus indicator in parity with the TextBox.
Fixes dotnet#15127
Fixes dotnet#15127

Match UpDown modern focus indicator thickness to TextBox

The Net11 UpDown focus edge used 3 DIP instead of 2 DIP.
Use 2 DIP in UpDownBase.cs while retaining the shared edge geometry.
This puts the UpDown focus indicator in parity with the TextBox.

<img width="571" height="481" alt="15127_done"
src="https://github.com/user-attachments/assets/f0e55998-00b7-48ec-87e4-624e6332846f"
/>
@LeafShi1
LeafShi1 requested a review from a team as a code owner September 18, 2026 01:26
@LeafShi1 LeafShi1 changed the title Backport RC2 integration changes into release/11.0 [release/11.0] Backport RC2 integration changes into release/11.0 Sep 18, 2026
SimonZhao888 and others added 2 commits September 21, 2026 15:34
…parent GroupBox BackgroundImage in VisualStylesMode.Net11 (dotnet#15159)

* Fix failure test case

* Fix_Issue_15122: CheckBox and RadioButton render transparently over a parent GroupBox BackgroundImage in VisualStylesMode.Net11

* Handle feedback

* Handle failure test case

---------

Co-authored-by: Simon Zhao (BEYONDSOFT CONSULTING INC) <v-weidzh@microsoft.com>
…arness (dotnet#15163)

## Proposed changes

- Add a shared C#/VB analyzer test harness and migrate existing analyzer
and code-fix tests to it.
- Add WFO3000-WFO3012 design-time guardrails for generated partial
structure, unrolled `InitializeComponent` code, CodeDOM-incompatible
constructs, and VB event wiring.
- Add WFO2000 as a general usage warning for property getters that
directly return newly constructed reference instances.
- Detect designer types and member ownership semantically, including
`System.ComponentModel.Component` descendants while excluding namespace
lookalikes, inherited/external fields, and ordinary user-code
references.
- Make WFO3000, WFO3001, WFO3003, WFO3004, WFO3006-WFO3008, and
WFO3010-WFO3012 errors by default; retain warnings for WFO3002, WFO3005,
WFO3009, and WFO2000.
- Include concise, language-appropriate repair guidance and synchronize
help, release tracking, and localization resources.

This is the `main`-targeted replay of dotnet#15148. The feature commits were
rebased automatically rather than cherry-picked individually.

## Customer impact

- Catch generated-code mistakes that break designer loading or
serialization, even when the code would run correctly.
- Give developers and coding agents actionable mitigation guidance
without changing application runtime behavior.
- Keep each diagnostic independently configurable.

## Regression?

No shipped runtime regression is addressed. This introduces analyzer
guardrails and fixes false positives, missed cases, and VB analyzer
exceptions found while developing them.

## Risk

Medium: the selected enabled-by-default errors can fail builds
containing unsupported Designer-generated code. Detection is limited to
matching designer partials and framework symbols, except the explicitly
general WFO2000 usage rule. No automatic code fixes are offered for
transformations that could alter ownership, event wiring, disposal, or
threading behavior.

## Test methodology

- Rebased all 10 commits from dotnet#15148 onto `origin/main` at `dadb02ecc`
with no conflicts.
- `git range-diff` reports all 10 replayed commits as patch-equivalent.
- All 516 analyzer tests pass: shared 73, C# 385, Visual Basic 58.

## Test environment

- Windows x64.
- Repository-local .NET runtime `12.0.0-alpha.1.26466.113`.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/15163)

@KlausLoeffelmann KlausLoeffelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks still good! Even in combination of them all!
Amazing job, everyone!!

@KlausLoeffelmann
KlausLoeffelmann merged commit ba35870 into dotnet:release/11.0 Sep 21, 2026
8 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc2 milestone Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants