ONLY FOR TESTING: Integration Branch for the new .NET 11 API#14746
Closed
KlausLoeffelmann wants to merge 71 commits into
Closed
ONLY FOR TESTING: Integration Branch for the new .NET 11 API#14746KlausLoeffelmann wants to merge 71 commits into
KlausLoeffelmann wants to merge 71 commits into
Conversation
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>
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>
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>
…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>
…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>
…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>
* Add solution folders "Application" and "net11-VisualStylesMode" to Winforms.sln and include a detailed Markdown work order for porting non-client painting and VisualStylesMode chrome to VisualStylesNet11. * Update solution structure to organize these items for engineering reference.
…lesNet11 Bring the non-client (NC) painting feature for TextBoxBase/TextBox from the pinned SHA cf32e9c onto the modern VisualStylesNet11 layout, with the DECIDED design changes and the Prompt-2 MUST-FIX items applied. TextBoxBase.cs: * Add VisualStyles border-padding consts + BorderThickness and the _triggerNewClientSizeRequest latch (reset in CreateHandle). * Split PreferredHeight into a VisualStylesMode switch over PreferredHeightCore (modern) and PreferredHeightClassic (Everett-compatible). Dropped the original [Experimental]/WFO5000 gating - VisualStyles is not experimental on this branch. * Add GetVisualStylesPadding / virtual GetScrollBarPadding (DPI-scaled). * Add the VisualStylesMode >= Net11 branch to GetPreferredSizeCore. * Add WmNcPaint / OnNcPaint / InitializeClientArea / WmNcCalcSize and the WM_NCCALCSIZE / WM_NCPAINT WndProc cases; wire InitializeClientArea into InitializeDCForWmCtlColor. * Add NC-frame invalidation to OnGotFocus / OnLostFocus / OnSizeChanged (OnLostFocus now correctly guarded by VisualStylesMode, fixing the original asymmetry). DECIDED design (work-order steps 6-8): * Use the shared BufferedGraphics buffer (BufferedGraphicsManager.Current) instead of the per-instance NonClientBitmapCache; buffer.Render() blits to the window DC. * Use the shipped Graphics.FillRoundedRectangle / DrawRoundedRectangle methods. * Never-invert clamp in WmNcCalcSize (no MinimumSize); paint-time chrome degradation in OnNcPaint below the viable rounded-chrome height. * Fixed the WmNcPaint double-dispose. MUST-FIX: * DPI-scale the corner radius and border thickness (and the degradation threshold) via LogicalToDeviceUnits. TextBox.cs: * Guard the classic PRF_NONCLIENT Fixed3D border draw so it does not double-draw over the modern chrome when VisualStylesMode >= Net11. NativeMethods.txt: * Generate GetWindowDC and NCCALCSIZE_PARAMS. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Previously InvokeCallbackAsync used 'catch (Exception ex) when (ex is not OperationCanceledException)', which let an OperationCanceledException escape the handler entirely. Because the callback runs as a discarded fire-and-forget task (SyncContext.Post of '_ = InvokeCallbackAsync(...)'), the escaping OCE faulted that task into an unobserved task exception that only surfaced via TaskScheduler.UnobservedTaskException on GC. Catch the OCE explicitly and ignore it when our cancellation token is signalled (mirroring the TimerLoopAsync convention), so cancellation during timer shutdown is a clean no-op. Genuine, non-cancellation exceptions still route to Debug.Fail. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
VisualStylesMode and DataContext are ambient via property-store absence, which is sufficient at runtime and for the normal serialization path. But a 'truly ambient' property the designer can reset also needs a writable 'inherit' token: the CodeDOM serializer (PropertyMemberCodeDomSerializer) substitutes an [AmbientValue] when it is forced to emit an otherwise-ambient property (inherited/'difference' forms, member relationships, absolute serialization). Without it the resolved concrete value is baked in, breaking re-inheritance in those designer scenarios. VisualStylesMode had no inherit sentinel, so [AmbientValue] had no correct value to use. Add one, mirroring RightToLeft.Inherit: * Add VisualStylesMode.Inherit (= -1). It is an assignable sentinel; the resolved value is never Inherit (the getter resolves a stored/assigned Inherit to the parent or Application.DefaultVisualStylesMode), so the '>= Net11' gating elsewhere is unaffected. * Annotate Control.VisualStylesMode with [AmbientValue(VisualStylesMode.Inherit)] and make the setter treat Inherit (and 'equals parent') as 'clear the local override' so it re-inherits; raise the change event only when the resolved value changes. * Reject VisualStylesMode.Inherit in Application.SetDefaultVisualStylesMode (the app root has no parent to inherit from); also validate undefined values there. * DataContext deliberately keeps NO [AmbientValue]: its setter stores an explicit null rather than clearing the override, so null would be a leaky 'inherit' sentinel. Added a maintainer comment explaining why. Update PublicAPI.Unshipped.txt, SR + xlf, and the VisualStylesMode unit tests (the old '-1 is invalid' case is now Inherit; add re-inherit, never-returns-Inherit, and SetDefaultVisualStylesMode(Inherit) throws coverage). 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>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…or TextBoxBase WM_NCPAINT now passes base.WndProc a client-excluding update region (screen coordinates) so the default themed non-client paint no longer erases the edit client area (e.g. on hover) for scrollbar-bearing TextBox/RichTextBox. Also: fix Release-only CS8175 by capturing the cached Pen (not the ref-struct scope) in the OnNcPaint focus-line local functions; extract the RichEdit-specific ScrollToCaret logic into a RichTextBox override of a new private protected virtual ScrollToCaretCore; and documentation/comment cleanups (GetVisualStylesPadding, GetPreferredSizeCore, WindowText, PaddingChanged) plus Everett capitalization. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Shrink the gap between the rounded button body and the outer focus ring and grow the body to reclaim that space. When the focus ring is not drawn, the body now expands to fill the ring+gap band via a focus-aware GetContentPadding hook, so unfocused buttons feel less cramped without changing the control's Padding. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port the prototype material key-cap renderer into System.Windows.Forms.Rendering.Button (renamed to Popup/FlatStyle conventions, no MaterialKey naming). Button owner-paints FlatStyle.Popup under modern visual styles or dark mode via a timer-driven AnimatedPopupButtonRenderer that interpolates hover/press channels through the shared AnimationManager, mirroring the CheckBox toggle switch. Border width/color are read from FlatButtonAppearance. The old PopupButtonDarkModeRenderer is removed; the dark-mode adapter keeps the modern renderer for Popup layout only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Integrate the application text-size and Windows accent-color APIs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Integrate configurable TreeView node-leading behavior and its tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Integrate painting and relocation suspension APIs and control rendering improvements. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Integrate kiosk and full-screen management APIs with their lifecycle tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Integrate VisualStylesMode, modern control rendering, and the latest rendering follow-ups. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200 # Conflicts: # src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/ApplyApplicationDefaultsEventArgs.vb # src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb
Remove duplicate nullable and Form system-text entries introduced while merging independent API branches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
Paint rounded cutouts from the real parent surface, refresh live visual-style changes, correct TextBox and UpDown geometry, normalize rounded paths, and improve Popup sizing and motion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a909fa48-8991-4d3a-8b90-617a4c026200
* Add a bit of formatting/refactoring while reviewing.
Paint parent content beneath antialiased chrome, reduce TextBox and UpDown sizing, and cover native border suppression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 225d4d4c-7dd7-46f1-9406-b30ff07bd8b5
- Refactored and enhanced modern button rendering for .NET 11+ visual styles, including FlatStyle.Standard, FlatStyle.Flat, and FlatStyle.Popup. - Improved image and text layout accuracy in ButtonBaseAdapter and ButtonDarkModeAdapter, with new properties for word wrapping, image clipping, and preferred size insets. - Modern renderers now select automatic foreground colors to ensure WCAG-compliant contrast, adding outlines if needed. - Popup button palette logic tracks bowl extremes for better contrast. - ButtonBase and CheckBox reset animators on system color changes. - Preferred size calculations now use renderer metrics. - Consolidated painting logic in ButtonDarkModeAdapter. - Added methods for content bounds and chrome size in PopupButtonKeyCapRenderer. - Expanded tests for layout, preferred size, color contrast, and system color changes. - Updated internal APIs and test helpers to support these improvements.
- Use Windows accent color for CheckBox/RadioButton glyphs by default, with high contrast support and cache invalidation on system color changes. - Animate hover/focus states independently for CheckBox, RadioButton, and ToggleSwitch; add new animation channels and blending logic. - ToggleSwitch animates thumb growth on hover, uses accent color for "on" state, and improves DPI/font scaling geometry. - FlatButtonAppearance returns automatic state colors only for non-Popup styles; Popup respects explicit values. - Update TextBoxBase geometry constants (e.g., corner radius to 15), use accent color for focus unless in high contrast. - Add and update tests for accent color, animation, geometry, and accessibility. - Refactor and clean up code, adding helpers for color blending, geometry, and animation state management.
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
Remove the obsolete awareness entries left by earlier feature merges and keep one entry for each remaining Application and Form API. 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
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
Exclude live native scrollbar rectangles from modern non-client chrome blits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9c3dc32b-7202-48c4-b0c7-f40a0a681ee2
This was referenced Jul 17, 2026
Clear the residual native edit edge, animate the clipped rounded focus indicator, and expose padding consistently on up-down controls. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33fa13dc-4960-4c84-a4fb-d1ab91741b73
This was referenced Jul 17, 2026
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.
This branch is for testing purposes, and will remain in draft.
Use it, to compile the planned new .NET 11 API at a whole.
Microsoft Reviewers: Open in CodeFlow