ONLY FOR TESTING: Integration-4 for the new .NET 11 API - #14792
ONLY FOR TESTING: Integration-4 for the new .NET 11 API#14792KlausLoeffelmann wants to merge 107 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 27022e2a-9eb8-4f58-9bfa-e79ca0d6c559
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hand-author the IUISettings3 / UIColor / UIColorType WinRT ABI types and generate the RoActivateInstance / WindowsCreateString / WindowsDeleteString / IInspectable / HSTRING Win32 bindings via CsWin32. The WinRT ABI types are excluded from the .NET Framework build, which does not consume them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Expose the user's current Windows accent color by activating the Windows.UI.ViewManagement.UISettings runtime component and reading UIColorType.Accent. When no accent color is set, Windows returns an OS-defined default, so the method always yields a usable color. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use event subscriptions as the opt-in for text-size notifications and remove the redundant awareness API surface. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40d0f0f7-a584-4167-9187-9d529b7c70f8
Wrap the Form event remark in a paragraph and remove the redundant nullable handler initialization reported by the Arcade analyzers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40d0f0f7-a584-4167-9187-9d529b7c70f8
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 27022e2a-9eb8-4f58-9bfa-e79ca0d6c559
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 20883488-cf1e-4ad3-a681-0724e9f16777
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Implements suspend painting and relocation scopes, deferred child positioning, and form appearance mode infrastructure for .NET 11. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rface Splits DeferLocationChange out of this branch entirely (postponed pending an anchor-layout-engine integration fix; tracked separately in #12) and reworks ISupportSuspendPainting / ISupportSuspendRelocation on Control to match the final API shape agreed in dotnet#14585: - Control implements ISupportSuspendPainting/ISupportSuspendRelocation via explicit interface implementation instead of public virtual methods, so the manual Begin/End pair does not become the primary IntelliSense surface on every Control-derived type. Protected virtual BeginSuspendPaintingCore() / EndSuspendPaintingCore() / BeginSuspendRelocationCore() / EndSuspendRelocationCore() are the new override points. - ListView, ListBox, ComboBox, TreeView, RichTextBox override the ...Core() hooks instead of the old public virtual methods, still routing through their existing BeginUpdate/EndUpdate. - SuspendPaintingScope and SuspendRelocationScope change from readonly ref struct to sealed class : IDisposable, so the scope can span an await in an asynchronous UI event handler (a ref struct cannot be hoisted into an async state machine - this was the flagship usage scenario in the original API proposal, and it did not compile against the ref struct version). Dispose is idempotent. - Deletes DeferLocationChangeScope.cs and the Control.DeferLocationChange overloads entirely. - Updates/removes tests accordingly; updates PublicAPI.Unshipped.txt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…inel Matches the final API shape agreed in dotnet#14585: - FormAppearanceMode -> FormRevealMode, adding Inherit = -1 as the ambient sentinel (Classic stays the CLR default value 0, matching the RightToLeft.Inherit / VisualStylesMode.Inherit precedent for ambient enums - the sentinel is a distinct value, not the zero value, so default(FormRevealMode) stays conservative). - Form.FormRevealMode is now a real public virtual, PropertyStore-backed, [AmbientValue(Inherit)] property (previously there was no per-Form property at all - only the flat, process-wide Application.FormAppearanceMode existed). This lets a form such as a splash screen opt itself out of deferred reveal without touching the process-wide default. Resolution is flat (Form only, no Control-parent-chain): DWM cloaking only ever applies to top-level, non-MDI-child windows, so there is no hierarchy to walk, unlike VisualStylesMode's genuine control-nesting cascade. - Application.FormAppearanceMode / SetFormAppearanceMode are replaced by three members: DefaultFormRevealMode (get; may return the unresolved Inherit sentinel, mirroring ColorMode returning the unresolved System value), SetDefaultFormRevealMode (freely reassignable, unlike the write-once SetDefaultVisualStylesMode - the effective default is derived in part from ColorMode/IsDarkModeEnabled, which are themselves mutable for the life of the process), and IsFormRevealDeferred (bool; the fully resolved answer: Deferred, or Inherit + IsDarkModeEnabled). This also fixes a compatibility problem in the original design: the old default was unconditionally Deferred whenever SetFormAppearanceMode was never called, an opt-out behavior change for every existing app; tying the Inherit resolution to dark mode means an app that never touches SystemColorMode sees no behavior change, while the scenario the feature exists for (dark-mode startup flash) is fixed by default. - ShouldUseDeferredAppearanceCloak now reads the resolved Form.FormRevealMode instead of the old flat Application-only check, so a per-Form override is actually honored. - Adds SR.resx/xlf entries for the new property's designer description. - Updates/adds tests; updates PublicAPI.Unshipped.txt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds Microsoft.VisualBasic.ApplicationServices.ApplyApplicationDefaultsEventArgs.FormRevealMode, following the exact same pattern already established for ColorMode and HighDpiMode in that class, per dotnet#14585's API Proposal. WindowsFormsApplicationBase now carries a _formRevealMode shadow field (defaulting to FormRevealMode.Classic, matching the existing conservative default for _colorMode) and a protected FormRevealMode property, feeds it into the ApplyApplicationDefaultsEventArgs constructor alongside MinimumSplashScreenDisplayTime/HighDpiMode/ColorMode, reads back whatever the ApplyApplicationDefaults event handler set, and calls Application.SetDefaultFormRevealMode(_formRevealMode) at the end of OnInitialize alongside the existing Application.SetColorMode(_colorMode) call. This completes work anticipated but never finished in an earlier .NET 9 Visual Styles attempt at this same VB Application Framework extension point (OnInitialize already carried a comment claiming "We feed the defaults for HighDpiMode, ColorMode, VisualStylesMode to the EventArgs", but only HighDpiMode/ColorMode were ever actually wired up). Updates PublicAPI.Unshipped.txt for Microsoft.VisualBasic.Forms. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 20883488-cf1e-4ad3-a681-0724e9f16777
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 20883488-cf1e-4ad3-a681-0724e9f16777
Remove the risky relocation API and add controlled layout traversal to painting scopes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9c3dc32b-7202-48c4-b0c7-f40a0a681ee2
…ng, and test cancellation/nullable guidance - building-code: add a top-level TENET to build the solution only with build.cmd (CI parity for PublicAPI/analyzer enforcement and -warnAsError); a plain dotnet build is inner-loop only. - new-control-api: new public/protected overrides must be tracked in PublicAPI.Unshipped.txt with the override prefix; note CS0114 (new keyword) and CS1574 (no cref to cross-assembly internal types). - control-api-tests: async tests must pass CancellationToken (TestContext.Current.CancellationToken, CA2016/xUnit1051) and respect the #nullable context (CS8632). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Refactor KioskModeManager component and introduce WakeUp-Events incl.. new WakeUpEventArgs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 20883488-cf1e-4ad3-a681-0724e9f16777
…n Button and CheckBox toggle renderers Introduces the (non-experimental) Visual Styles versioning API and the first modern renderers gated behind it: - VisualStylesMode enum (Classic/Disabled/Net11/Latest); ambient Control.VisualStylesMode (+event/On-methods); Application.DefaultVisualStylesMode/SetDefaultVisualStylesMode; Appearance.ToggleSwitch; VB framework APIs. - HighPrecisionTimer (internal, Primitives) as the animation frame trigger, with tests. - AnimationManager/AnimatedControlRenderer driven by HighPrecisionTimer. - Conservative dark-mode Standard button (owner-drawn, reachable) + modern WinUI-style Button renderer. - CheckBox Appearance.ToggleSwitch modern toggle switch (animated, flicker-free). - WinformsControlsTest VisualStylesButtons exploratory harness; unit tests. Verified CI-clean with build.cmd: System.Windows.Forms, Microsoft.VisualBasic.Forms and Primitives build with no analyzer/PublicAPI/style errors (the only remaining failure is the pre-existing BuildAssist/AxHosts step, which is an environment limitation unrelated to these changes). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Base ShouldSerializeVisualStylesMode on the raw PropertyStore entry so Inherit emits no CodeDOM while explicit values round-trip through designer serialization. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 24d81626-c337-40c8-a515-393ee8e9827d
Move affected property contracts into partial declarations and add adaptive-layout guidance for metric growth, fixed-bounds editors, GroupBox content geometry, and aligned TextBox/ComboBox rows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 24d81626-c337-40c8-a515-393ee8e9827d
Apply native selection-field height overrides only while modern metrics are active, or while restoring a field that previously used them, so classic owner-drawn item bounds remain unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 24d81626-c337-40c8-a515-393ee8e9827d
Assert the fixed non-owner-drawn mouse-over geometry instead of retaining the previous unsupported-adapter exception expectation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 24d81626-c337-40c8-a515-393ee8e9827d
Render Standard as a borderless rectangular surface, use an accent outline for Flat and an accent header for Popup, and select real installed Semibold faces without mutating ambient fonts. Align caption and content metrics with Padding and preserve the existing visual-settings tracker cleanup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 24d81626-c337-40c8-a515-393ee8e9827d
Reactivate designer serialization for the shipped Padding property, add a one-pixel framework inset, render rounded Standard and Popup frames plus a square Flat frame, and keep native edit/list content aligned across DPI, style, and layout changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 24d81626-c337-40c8-a515-393ee8e9827d
Accept the native System-style handle recreation's platform-dependent zero-or-one invalidation while retaining exact expectations for owner-drawn styles. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 24d81626-c337-40c8-a515-393ee8e9827d
Reintroduce the consolidated accessibility text-scale helper dropped during Integration-3 replay so SystemVisualSettingsTracker and font scaling share one registry implementation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 24d81626-c337-40c8-a515-393ee8e9827d
ShouldUseDeferredAppearanceCloak() gated the DWM cloak on Visible == true, but it is only evaluated from OnHandleCreated, where a top-level form's window is still hidden (WS_VISIBLE is cleared from the create params and the show is deferred). The Visible state bit is not set until WM_SHOWWINDOW is processed, so the guard was always false, the cloak never engaged, and the window was shown uncloaked - still producing the default-background flash the mode is meant to prevent. Remove the Visible term so the already-hidden window is cloaked at handle creation. This covers Show, ShowDialog (which creates the handle via CreateControl before showing) and handle recreation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… button, no flicker, classic-safe) Squashed delta from Net11/VisualStylesMode-Fixes, applied on top of the Integration-3 result to produce Integration-4. Mirrors the same squash landed on the Net11Api_05_VisualStylesMode source-of-truth base. Includes: - Ambient visual-styles layout fix and the modern ComboBox renderer refactor (per-handle baseline, absolute target state, idempotent applier). - Modern ComboBox: WM_NCCALCSIZE unifies the field over the drop-down button; WM_NCHITTEST->HTCLIENT plus a press/release hit-test opens the list on a button click; double-buffered paint removes adorner flicker; wider button and edit window inset so the edit child clears the rounded arcs. - New Control.VisualStylesModeChangeImpact.Recreate: ComboBox returns it when crossing the modern/classic boundary so the handle is recreated and classic behaves exactly as before. WM_NCCALCSIZE gated off for Simple combos. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 64d20bbb-13df-4e59-8bcc-c307909b03f8
The modern (Net11+) UpDownBase content inset (ModernContentInset) used a flat 1px border-thickness term, so its edit and side-by-side buttons sat one pixel tighter inside the frame than a modern TextBoxBase (which uses the per-border-style border padding from ModernControlVisualStyles.GetFieldPadding). Switch to the same per-border-style constants so the internal padding matches: Fixed3D 3->4, None 2->3, FixedSingle unchanged at 3. Also document every metric in ModernControlVisualStyles with an XML summary, and update the UpDownBase modern-geometry tests to the new default (Fixed3D) inset of 4. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| /// Provides data for a <see cref="Application.SystemVisualSettingsChanged"/> or | ||
| /// <see cref="Control.SystemVisualSettingsChanged"/> event. | ||
| /// </summary> | ||
| public class SystemVisualSettingsChangedEventArgs : EventArgs |
There was a problem hiding this comment.
This should be sealed, It's an immutable DTO with an internal ctor (only the framework raises it), no virtual members, and no type hierarchy., there's no reason to allow inheritance. Also, unsealed→sealed is a breaking change later, while sealed→unsealed is not, so sealing now is the safe default
| /// own state to honor the user's Windows personalization and accessibility preferences. | ||
| /// </para> | ||
| /// </remarks> | ||
| public sealed class SystemVisualSettings |
There was a problem hiding this comment.
Minor: SystemVisualSettings.cs currently holds a few public types — might be worth splitting the enum and the EventArgs into their own files to match the usual one-type-per-file convention
| /// <see cref="Application.SystemVisualSettingsChanged"/>. | ||
| /// </param> | ||
| /// <param name="e">The event data.</param> | ||
| public delegate void SystemVisualSettingsChangedEventHandler(object? sender, SystemVisualSettingsChangedEventArgs e); |
There was a problem hiding this comment.
Could we use the built-in EventHandler<SystemVisualSettingsChangedEventArgs> instead of the custom SystemVisualSettingsChangedEventHandler delegate? The signature is identical (object? sender, SystemVisualSettingsChangedEventArgs e) , so there's no behavior change — it just saves us from adding a new permanent public type, and matches the current guidance to prefer EventHandler<TEventArgs> for new events.
API Review board final naming: the animation category flag is renamed from Animations to ClientAreaAnimations to match its underlying SystemVisualSettings.ClientAreaAnimationEnabled source. Value (1 << 3) unchanged. Updates the tracker, PublicAPI.Unshipped.txt, and tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 64d20bbb-13df-4e59-8bcc-c307909b03f8
Flicker-free UI mutation API: - Rename LayoutSuspendTraversal members for clarity and redefine semantics: None -> TargetOnly (0), TopLevelOnly -> TargetAndChildren (1, new: target plus immediate children), Traverse -> TargetAndDescendants (2). The painting-only (no layout suspension) case is now served solely by the parameterless SuspendPainting overload. - Make SuspendPaintingScope internal; the three ControlMutationExtensions .SuspendPainting overloads now return IDisposable. The await-safe / idempotent guidance moves to the public extension-method docs so it stays discoverable. - Document that Control implements ISupportSuspendPainting explicitly (callers use the IDisposable scope; overriders use Begin/EndSuspendPaintingCore). FormRevealMode: - Add the FormRevealModeChanged event and protected virtual OnFormRevealModeChanged, raised from the setter when the effective value changes. Updates PublicAPI.Unshipped.txt, SR.resx, and ControlTests.Methods.cs (including a new TargetAndChildren test). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 64d20bbb-13df-4e59-8bcc-c307909b03f8
Integration-4 also merges the VisualStyles slice (branch 05), whose AnimatedControlRenderer and associated tests consume the renamed enum member. Update those references so the integration compiles. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 64d20bbb-13df-4e59-8bcc-c307909b03f8
Generated by the build after adding the FormRevealModeChanged event description to SR.resx. Keeps the localized .xlf files in sync with the neutral resources. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 64d20bbb-13df-4e59-8bcc-c307909b03f8
Per follow-up review: the parameterless SuspendPainting overload already covers the painting-only case, but keeping an explicit None = 0 restores the intuitive default (no layout suspension) and avoids default(enum) silently suspending. TargetAndChildren is removed because the distinction from TargetOnly was subtle and confusing (a container's SuspendLayout already holds its children's layout). Final enum: None = 0, TargetOnly = 1, TargetAndDescendants = 2. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 64d20bbb-13df-4e59-8bcc-c307909b03f8
…rst paint Deferred reveal cloaked the form at OnHandleCreated and uncloaked on the form's own first WM_PAINT. That paint fires before the child controls - separate child windows - paint their first frame, so the window was revealed mid-paint and the tail of the startup flash (controls popping in) was still visible. Reveal only after the whole control tree has painted its first frame: - Add Form.RevealDeferredAppearance(): force a synchronous full-tree paint of the still-cloaked window (RedrawWindow RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN| RDW_UPDATENOW), then uncloak, so the finished frame appears at once. It is a no-op once revealed / never cloaked, and guarded against re-entrancy since RDW_UPDATENOW dispatches WM_PAINT synchronously. - Trigger it from OnShown (CallShownEvent) as the primary, guaranteed one-shot point that runs before the first natural WM_PAINT, and keep the WM_PAINT hook as an idempotent fallback so the window can never be revealed mid-paint or stay stuck cloaked. Adds a safety-invariant test: a shown Deferred form must not remain cloaked. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 64d20bbb-13df-4e59-8bcc-c307909b03f8
| { | ||
| _threadId = Environment.CurrentManagedThreadId; | ||
| _threadExitHandler = OnThreadExit; | ||
| _timerRegistration = HighPrecisionTimer.Register(OnFrameTickAsync); |
There was a problem hiding this comment.
The constructor registers _timerRegistration, but it's not released after the last renderer is removed in UnregisterAnimationRenderer/Suspend. Once the manager is initialized, the HighPrecisionTimer registration persists, causing the UI thread to idle for an extended period until the thread exits, a clear example of idle overhead regression. Recommendation: Release/pause timer registration when _renderer becomes null; then lazily resume initialization the timer the next time a renderer is available.
| metrics, | ||
| textSize); | ||
|
|
||
| graphics.Clear(Control.BackColor); |
There was a problem hiding this comment.
AnimatedToggleSwitchRenderer.RenderControl currently clears with graphics.Clear(Control.BackColor). This bypasses the normal WinForms background pipeline (parent background, transparent background, background image/custom-painted parent), which can cause visual regressions on complex backgrounds.
Please switch to the standard WinForms background painting path (e.g., Control.PaintBackground(...) with PaintEventArgs and ClientRectangle) instead of direct Clear. That preserves both:
- parent/transparent background semantics, and
- proper BackColor blending behavior (including semi-transparent colors).
Suggested modifications:
using PaintEventArgs paintEventArgs = new(graphics, Control.ClientRectangle);
Control.PaintBackground(paintEventArgs, Control.ClientRectangle);
Issue link: #14807
This branch is for integration testing only and must not be merged.
Component branches: Net11Api_00 through Net11Api_05 (
Net11Api_05_VisualStylesModeis the source of truth for the VisualStyles work), plus the modern ComboBox refinements fromNet11/VisualStylesMode-Fixes.SystemVisualSettings proposal: KlausLoeffelmann#14
It combines the independently reviewed Net11 API branches B00 through B05 and adds the
cross-feature composition for:
SystemVisualSettingsVisualStylesModeChangeImpact.Recreate)Additional modern ComboBox work in Integration-4
Relative to Integration-3, this branch adds the modern ComboBox chrome/interaction fixes:
WM_NCCALCSIZE), so the button no longer renders as a separate block outside the rounded field.WM_NCHITTESTreturnsHTCLIENTover the expanded client and a press/release hit-test drivesDroppedDown.VisualStylesModeacross the modern/classic boundary now recreates the handle (via the newVisualStylesModeChangeImpact.Recreate), so classic behaves exactly as before and a fresh modern handle captures a clean baseline.WM_NCCALCSIZEis gated off forComboBoxStyle.Simple.Fixes #14773
The PR remains a draft validation surface for the complete .NET 11 API set.
Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow