dotnet / dotnet/winforms

[Epic] .NET 11 new WinForms API surface (accessibility-driven)

Open
#14,694 0 comments 0 reactions 1 assignee Claimed by @KlausLoeffelmann View on GitHub
epic NewApi-Net11
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

## Overview

Tracking issue for the .NET 11 WinForms API proposals authored/updated in this batch. Each is its own `api-suggestion` issue and stands on its own for API review; this issue exists to keep them visible as a related cluster and to track implementation status and cross-cutting follow-up work.

## API proposals in this batch

- #14583 - `Application.SystemTextSize` - runtime awareness of the Accessibility text-scale setting (branch `Net11Api_01_New_Application_Api` also adds `Application.GetWindowsAccentColor()`)
- #14584 - `TreeView.NodeLeading` - opt-in, text-scale-aware node-row height (depends on #14583)
- #14585 - Add APIs for performance improved, flicker-free WinForms UI mutation (`ISupportSuspendPainting`/`ISupportSuspendRelocation`, `Form.FormRevealMode`)
- #14586 - Introduce `KioskModeManager` component
- #14587 - Visual Styles feature (`VisualStylesMode`), postponed from .NET 9 and .NET 10

Related, not part of this batch:

- #4958 - Introduce `ApplicationDefaults` for `Application` and the VB Application Framework (the existing `ApplyApplicationDefaults` mechanism these proposals extend)
- #7641 - Original upstream dark-mode/Visual Styles ask that #14587 was extracted from
- KlausLoeffelmann/winforms#12 - `DeferLocationChange` batch child-location API, split out of #14585 and postponed

## Implementation tracking

Each feature branch is tracked with three independent check-offs:

1. **Branch Implemented** - the branch matches the current, agreed API shape in the linked issue and builds/tests cleanly.
2. **Klaus Test-App Approval** - exercised through the shared exploratory test app and Klaus is satisfied with the runtime behavior.
3. **WinForms Team Testing** - Olina or Leaf (Beyondsoft) have tested and signed off.

### #14585 - Flicker-free UI mutation (`ISupportSuspendPainting`/`ISupportSuspendRelocation`, `Form.FormRevealMode`)

Branch: `KlausLoeffelmann/winforms` @ `Net11Api_03_ImproveControlRendering` (renamed from `ImproveControlPositioningAndRendering` now that `DeferLocationChange` is split out)

- [x] Branch Implemented
- [ ] Klaus Test-App Approval
- [ ] WinForms Team Testing

### #14587 - Visual Styles (`VisualStylesMode`, modern `Button`/`CheckBox`/`RadioButton`, `TextBoxBase.Padding`)

Branch: `KlausLoeffelmann/winforms` @ `Net11Api_05_VisualStylesMode`

- [x] Branch Implemented
- [ ] Klaus Test-App Approval
- [ ] WinForms Team Testing

### #14586 - `KioskModeManager` component

Branch: `KlausLoeffelmann/winforms` @ `Net11Api_04_KioskManagerComponent`

- [x] Branch Implemented
- [ ] Klaus Test-App Approval
- [ ] WinForms Team Testing

### #14583 - `Application.SystemTextSize` / `SystemTextSizeAwareness`

Branch: `KlausLoeffelmann/winforms` @ `Net11Api_01_New_Application_Api`

- [x] Branch Implemented
- [ ] Klaus Test-App Approval
- [ ] WinForms Team Testing

### #14584 - `TreeView.NodeLeading`

Branch: `KlausLoeffelmann/winforms` @ `Net11Api_02_TreeView_NodeLeading`

- [x] Branch Implemented
- [ ] Klaus Test-App Approval
- [ ] WinForms Team Testing

## Refactoring / follow-up work tracked here

- [x] Rework #14585: rename `FormAppearanceMode` -> `FormRevealMode` (`Inherit`/`Classic`/`Deferred`); remove the `DeferLocationChange` sub-feature (now tracked separately, see KlausLoeffelmann/winforms#12); change `SuspendPaintingScope`/`SuspendRelocationScope` from `readonly ref struct` to `sealed class : IDisposable`; make `ISupportSuspendPainting`/`ISupportSuspendRelocation` explicit interface implementations on `Control` with protected `...Core()` hooks instead of public virtual methods; add `Application.DefaultFormRevealMode` / `SetDefaultFormRevealMode` / `IsFormRevealDeferred`. (Issue text updated; branch implementation tracked above.)
- [x] Extend #14587's API Proposal with `Microsoft.VisualBasic.ApplicationServices.ApplyApplicationDefaultsEventArgs.VisualStylesMode`, completing the VB Application Framework wiring anticipated (but never finished) back in the .NET 9 Visual Styles attempt. (Issue text updated; branch implementation tracked above.)
- [x] Extend #14585's API Proposal with `Microsoft.VisualBasic.ApplicationServices.ApplyApplicationDefaultsEventArgs.FormRevealMode`, following the same `ColorMode`/`HighDpiMode` pattern already established in that class. (Issue text updated; branch implementation tracked above.)
- [x] Normalize Markdown paragraph formatting across #14583, #14584, #14585, #14586, #14587 for consistency (hard-wrapped vs. single-line-per-paragraph source style - both render identically on github.com, but consistency helps terminal/CLI review).
- [x] Fix malformed C# in #14583's API Proposal code block (`GetSystemTextSize()` -> `SystemTextSize` property; invalid `SetSystemTextSizeAwareness` signature) before implementation started.
- [ ] Investigate a `TreeView.FullRowSelect` rendering regression noticed during Visual Styles exploration; file a dedicated bug issue if reproduced independent of these proposals. Investigated: no regression found on `main` or `Net11Api_05_VisualStylesMode` (no `TreeView` file differences between them); current best diagnosis is the long-standing, already-documented native constraint that `FullRowSelect` has no visual effect while `ShowLines` is `true` (the WinForms default). Filed as KlausLoeffelmann/winforms#13 for further confirmation/follow-up, not treated as a regression from this batch of work.

## Branch summaries (as implemented)

- **`Net11Api_03_ImproveControlRendering`** (#14585): `FormRevealMode` (`Inherit`/`Classic`/`Deferred`) as a real `Form`-level ambient property backed by `PropertyStore`, resolving through `Application.DefaultFormRevealMode`/`IsFormRevealDeferred`; `SuspendPaintingScope`/`SuspendRelocationScope` as `sealed class : IDisposable` (async-await-safe); `ISupportSuspendPainting`/`ISupportSuspendRelocation` as explicit interface implementations on `Control` with protected `...Core()` override hooks; `DeferLocationChange` removed entirely (see KlausLoeffelmann/winforms#12). VB Application Framework wiring included. 3 commits, full targeted test pass (only a single pre-existing, unrelated DPI test failure reproduced independent of these changes).
- **`Net11Api_05_VisualStylesMode`** (#14587): added the missing `VisualStylesMode.LatestPreview` value; fixed a getter/setter coupling bug in the write-once `SetDefaultVisualStylesMode`; gated `TextBoxBase.Padding` to stay inert without a Net11+ opt-in; completed the VB Application Framework `VisualStylesMode` wiring. 3 commits.
- **`Net11Api_04_KioskManagerComponent`** (#14586): fixed `Site`/`ContainerControl` auto-resolution semantics (including explicit-`null` handling), `FullScreen` init-time deferral and dispose-time restore, `WakeUpCommand` parameter (wake-source string), replaced a static `SystemEvents` dependency with form-local power/session observation, keyboard handling correctness, and `ISupportInitialize` side-effect deferral. 2 commits, 49/49 targeted tests passing. Confirmed as one of the lower-risk branches in this batch, per the original working hypothesis.
- **`Net11Api_01_New_Application_Api`** (#14583): full implementation from scratch (branch previously had only the drafting prompt) - `Application.SystemTextSize`/`SystemTextSizeAwareness`/`SetSystemTextSizeAwareness`/static `SystemTextSizeChanged` via the leak-safe `SystemEvents.UserPreferenceChanged` architecture, plus `Form.SystemTextSizeChanged` via each form's own `WM_SETTINGCHANGE` handling (mirroring the existing DPI-change architecture to avoid rooting hazards). Now also adds `Application.GetWindowsAccentColor()` (WinRT `UISettings` accent color via a hand-authored `IUISettings3` ABI in `Microsoft.Private.Windows.Core`, no CsWinRT dependency; returns the OS default accent color when none is set), broadening the branch into the general "new `Application` API" bucket.
- **`Net11Api_02_TreeView_NodeLeading`** (#14584): full implementation from scratch (new branch, none existed previously) - `TreeView.NodeLeading` with the legacy/honest `ItemHeight` split, `TVS_NONEVENHEIGHT`/handle-recreate wiring, Font/DPI-aware recompute, and full designer serialization support. 2 commits, all `NodeLeading` tests passing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.