Skip to content

Add TitleBar drag-region APIs (WinApp SDK 2.1.3 uptake)#723

Open
azchohfi wants to merge 5 commits into
mainfrom
azchohfi-winapp-sdk-2-0-apis
Open

Add TitleBar drag-region APIs (WinApp SDK 2.1.3 uptake)#723
azchohfi wants to merge 5 commits into
mainfrom
azchohfi-winapp-sdk-2-0-apis

Conversation

@azchohfi

Copy link
Copy Markdown
Collaborator

Summary

Surveyed the Windows App SDK 2.x release notes for APIs Reactor could leverage, and adopted the one that lands squarely on an existing surface: the Microsoft.UI.Xaml.Controls.TitleBar drag-region APIs added in 2.1.3. Design is captured in spec 059.

Reactor's TitleBarElement already maps directly to WinUI.TitleBar and exposes a user Content slot (the gallery sample puts an AutoSuggestBox + Button there) — the exact mixed interactive/non-interactive scenario these APIs target.

Changes

  • SDK bump WindowsAppSDKVersion 2.0.1 → 2.1.3 (in-place servicing within the shared major-2 runtime family; aligns with the runtime already pinned in the perf CI script). Inherits the 2.1.3 default that auto-excludes interactive controls from TitleBar.Content drag regions.
  • .AutoRefreshDragRegions() on TitleBarElement — auto-maps through the wrapper generator (descriptor-only auto-discovery emits .OneWay<bool>(e => e.AutoRefreshDragRegions, …)). Default false (matches WinUI).
  • .IsDragRegion(bool? ) — cross-cutting modifier on any element (true = draggable, false = clickable). Stored on ElementModifiers, applied in Reconciler.ApplyModifiers via TitleBar.SetIsDragRegion / ClearValue, mirroring .IsTabStop() / AutomationName. Inert outside a title bar.
  • RecomputeDragRegions() intentionally not surfaced — the declarative AutoRefreshDragRegions covers the reactive case (spec 059 §4.3).

Verification

  • Unit suite 9711 passed / 0 failed (4 new tests for the modifier/property plumbing).
  • Real-WinUI selftest TitleBar_DragRegions: confirms AutoRefreshDragRegions round-trips onto the control and .IsDragRegion(false) writes the attached property on a child. All TitleBar selftests green.
  • Core library, test host, and ReactorGallery sample build clean.

Also updated

bootstrap.ps1 version comment, gallery TitleBarPage demo, windowing skill + windows.md guide (template + recompiled), and the API index (reactor.api.txt).

Considered but deferred (2.2.0)

XamlBindingHelper boxing-free value setters, Setter.ValueProperty, and ApplicationData.GetForUnpackaged() — see spec 059 §5.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Bump Windows App SDK 2.0.1 -> 2.1.3 and surface the new Microsoft.UI.Xaml.Controls.TitleBar drag-region APIs: TitleBarElement.AutoRefreshDragRegions (auto-mapped via the wrapper generator) plus a cross-cutting .IsDragRegion(bool?) modifier applied in Reconciler.ApplyModifiers via TitleBar.SetIsDragRegion/ClearValue. Adds spec 059, unit tests, a real-WinUI selftest (TitleBar_DragRegions), gallery demo, and windowing docs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
azchohfi and others added 2 commits June 26, 2026 21:17
The 2.1.3 framework bump left the dotnet-new template, the CLI local-scaffold csproj, and the install snippets pinning Microsoft.WindowsAppSDK 2.0.1/2.0.*. NuGet rejects that as a downgrade (NU1605) against the framework's new >= 2.1.3 dependency, failing the Integration Tests (template smoke) and bootstrap.ps1 CI jobs. These standalone pins do not inherit the central WindowsAppSDKVersion and must be bumped in lockstep.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Addresses findings from the multi-dimensional PR review:

- H1 (high): ElementModifiers.Merge dropped IsDragRegion, so .IsDragRegion() was silently lost unless it was the FIRST modifier in a chain (the shipped gallery-sample order). Wire it into Merge. Regression test added; the selftest now applies .IsDragRegion() after .Width() to exercise it end-to-end.
- H2 (high): ModifiersEqual omitted IsDragRegion, so the reconciler skip fast-path collapsed runtime toggles. Add it to the comparison (+ unit test).
- M1: ElementPool.CleanElement now clears TitleBar.IsDragRegionProperty so a pooled control can't carry a stale value to the next renter.
- M5: CHANGELOG entry (spec 059). M6: pack the reactor-windowing agent-kit skill (was absent from the pack list, so its docs would not ship).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Reactor to Windows App SDK 2.1.3 and surfaces the WinUI TitleBar drag-region APIs in a declarative Reactor-friendly way: a TitleBarElement.AutoRefreshDragRegions property + fluent modifier, and a cross-cutting .IsDragRegion(...) modifier backed by TitleBar.IsDragRegion.

Changes:

  • Bump Windows App SDK pins across the repo (central WindowsAppSDKVersion + template/scaffold/docs literals) to 2.1.3.
  • Add TitleBarElement.AutoRefreshDragRegions + .AutoRefreshDragRegions() sugar and wire TitleBar.IsDragRegion as an ElementModifiers-backed attached-property modifier applied by the reconciler (and cleared by pooling).
  • Add unit tests + a selftest fixture, and update docs/samples/skills + API index.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tools/Templates/templates/WinUIApp-CSharp/Company.ReactorApp1.csproj Template pin updated to WinApp SDK 2.1.3
tests/Reactor.Tests/ElementModifiersCoverageTests.cs Unit coverage for .IsDragRegion() modifier plumbing
tests/Reactor.Tests/ElementExtensionsCoverageTests.cs Unit coverage for .AutoRefreshDragRegions() sugar
tests/Reactor.AppTests.Host/SelfTest/SelfTestFixtureRegistry.cs Registers new TitleBar_DragRegions selftest fixture
tests/Reactor.AppTests.Host/SelfTest/Fixtures/Phase7WindowingFixtures.cs Adds TitleBar_DragRegions selftest implementation
src/Reactor/Reactor.csproj Packs the new reactor-windowing skill markdown into agentkit payload
src/Reactor/Elements/ElementExtensions.cs Adds .AutoRefreshDragRegions() and .IsDragRegion() modifiers
src/Reactor/Core/Reconciler.cs Applies/clears the TitleBar.IsDragRegion attached property via modifiers
src/Reactor/Core/ElementPool.cs Clears TitleBar.IsDragRegion on pooled controls to prevent state bleed
src/Reactor/Core/Element.cs Adds IsDragRegion to ElementModifiers + merge/equality; adds AutoRefreshDragRegions to TitleBarElement
src/Reactor.Cli/Program.cs Updates scaffolded csproj literal to WinApp SDK 2.1.3
skills/reactor.api.txt Updates API index for new modifiers/properties
SKILL.md Updates WinApp SDK version snippet to 2.1.3
samples/WinFormsInterop/README.md Updates WinApp SDK version snippet to 2.1.3
samples/ReactorGallery/ControlPages/Navigation/TitleBarPage.cs Demonstrates .IsDragRegion(false) + .AutoRefreshDragRegions()
plugins/reactor/skills/reactor-windowing/SKILL.md Documents drag regions + new modifiers in the windowing skill
plugins/reactor/skills/reactor-dsl/references/reactor.api.txt Updates embedded API reference for the DSL skill
docs/specs/059-titlebar-drag-regions.md Adds design spec for WinApp SDK 2.1.3 drag-region uptake
docs/guide/windows.md Documents drag regions usage in the Windows guide
docs/guide/README.md Updates WinApp SDK version snippet to 2.1.*
docs/guide/index.md Updates WinApp SDK version snippet to 2.1.*
docs/_pipeline/templates/windows.md.dt Updates Windows guide template with drag regions section
docs/_pipeline/templates/index.md.dt Updates index template WinApp SDK snippet to 2.1.*
Directory.Build.props Central bump to WindowsAppSDKVersion 2.1.3
CHANGELOG.md Adds changelog entry for TitleBar drag regions + SDK bump
bootstrap.ps1 Updates comment to reflect SDK 2.1.3 runtime expectation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Reactor/Elements/ElementExtensions.cs Outdated
Comment thread docs/guide/windows.md Outdated
Comment thread docs/_pipeline/templates/windows.md.dt Outdated
Comment thread plugins/reactor/skills/reactor-windowing/SKILL.md Outdated
Comment thread docs/specs/059-titlebar-drag-regions.md Outdated
Comment thread samples/ReactorGallery/ControlPages/Navigation/TitleBarPage.cs Outdated
- Make .IsDragRegion accept bool? (tri-state) so callers can forward a nullable state directly and match the documented .IsDragRegion(bool?) shape; api index updated.
- Parenthesize the 'with { ... }' expression before .AutoRefreshDragRegions() in every doc/skill/spec/sample snippet — member access on a with-expression needs parentheses, so the snippets now compile when copy/pasted (the compiled gallery code was already correct; only its displayed string was missing them).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.

Record that the 2.0.1 -> 2.1.3 bump raises every consumer's WindowsAppSDK floor, the reflection-guarded mitigation that was considered, and the rationale for accepting the bump (in-place servicing within the same side-by-side 2.x runtime family).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants