Skip to content

Build Reactor's DataTemplates from code instead of parsing markup - #1125

Draft
Alexandre Zollinger Chohfi (azchohfi) wants to merge 4 commits into
mainfrom
azchohfi-winui3-integration-datatemplate
Draft

Alexandre Zollinger Chohfi (azchohfi) wants to merge 4 commits into
mainfrom
azchohfi-winui3-integration-datatemplate

Conversation

@azchohfi

@azchohfi Alexandre Zollinger Chohfi (azchohfi) commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

Note

Still draft — but the blocker changed. The code-based DataTemplate constructor is now on nuget.org, so this branch no longer needs an internal build and CI can restore it. What now keeps it in draft is the cost of the channel, not availability: see Why this still cannot merge.

What this does

Reactor built two DataTemplates at runtime by handing XamlReader.Load a markup string:

  • SharedContentControlTemplate — the ContentControl shell every items control mounts (ListView / GridView / FlipView)
  • TreeViewTextItemTemplate — the legacy text-node TreeView item template

Both existed only because DataTemplate could not be constructed from code. WinUI now offers new DataTemplate(DataTemplateElementFactory), which takes a callback returning the subtree, so this ports both onto it and Reactor stops parsing XAML at runtime for item templates.

The part that is more than cosmetic

The TreeView template also loses its {Binding Content.Content}.

A classic {Binding} resolves that path by string, through CsWinRT's ICustomPropertyProvider — i.e. reflection. It is trimmed away under NativeAOT unless the source type carries generated binding metadata, and even where it works it costs a reflective lookup per realized row.

Reading the same chain in a DataContextChanged handler is strongly typed:

tb.DataContextChanged += static (sender, args) =>
{
    if (sender is not TextBlock text) return;
    text.Text = args.NewValue switch
    {
        TreeViewNode { Content: TreeViewNodeData d } => d.Content,
        TreeViewNode { Content: string s }           => s,
        TreeViewNodeData d                            => d.Content,
        _                                             => string.Empty,
    };
};

No metadata required, no reflective lookup, and the event re-fires when a virtualized row is recycled onto new data, so reused rows retext correctly. (x:Bind is not an option — it is a XAML-compiler feature, unavailable from a code-built subtree.)

Because that was the only {Binding} Reactor had, [WinRT.GeneratedBindableCustomProperty] on TreeViewNodeData — added by #1108 purely to keep it trim-safe — is removed along with the partial it forced onto a public record. There is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped (every tag predates #1108), so this takes away nothing that ever worked in a release. The limitation is documented in docs/aot-support.md instead.

Package versions

package version why
Microsoft.WindowsAppSDK.WinUI 2.6.6-experimental the constructor first shipped in 2.3.10-experimental; still absent from every stable release (checked through 2.7.0, released 2026-11-17: not in its projection, its winmd, or the winui3/release/2.7.0 source) and still Feature_ExperimentalApi on microsoft-ui-xaml main
Microsoft.WindowsAppSDK 2.6.6-experimental the aggregate that pairs with it (published 2026-11-07): its nuspec names WinUI 2.6.6-experimental and pins Runtime [2.6.6-experimental]

Both are public nuget.org packages, and the pairing satisfies the metapackage-nuspec rule in Directory.Build.props (spec 063 §3). No package-reference workaround is needed — an earlier revision of this PR carried one, and it has been removed; Reactor.AppTests.Host.csproj is now untouched by this branch.

Three incidental fixes this SDK requires:

  • CS8305 silenced for the generated XamlTypeInfo.g.cs only. The XAML compiler's generated file references the SDK's own experimental metadata providers (XamlControlsCharts / XamlControlsTabular), so every WinUI project emits it from code we do not own. It is an .editorconfig severity scoped to **/XamlTypeInfo.g.cs, not WarningsNotAsErrors: CI's doc-snippet gate passes -p:WarningsNotAsErrors=NU1900 on the command line, and a global property replaces the project value, which turned CS8305 back into an error there. CS8305 stays live for Reactor's own code (verified with a probe file naming DataTemplateElementFactory).
  • REACTORGEN016 downgraded to a suggestion in tests/ and samples/. Fix generated-wrapper XAML metadata registration under NativeAOT #1583 made the wrapper generator pick a unique IXamlMetadataProvider from the wrapped control's assembly. On this channel Microsoft.WinUI ships three (the same experimental Charts and Tabular providers behind CS8305; stable 2.2.1 and 2.7.0 ship one), so every wrapper of a built-in WinUI control warns, and Release fails. The generator then falls back to TryRegisterControlAssembly, which is what every wrapper emitted before Fix generated-wrapper XAML metadata registration under NativeAOT #1583. main's Release build has no REACTORGEN016, so this hides nothing else. Verified: the AppTests host's Release build had 7 errors without it and 0 with it.
  • Disambiguated the IElementFactory cref in IItemsRepeaterFactorySource. This SDK adds Microsoft.UI.Xaml.IElementFactory alongside Microsoft.UI.Xaml.Controls.IElementFactory, making the bare cref ambiguous (CS0419) and failing the warnings-as-errors Release build. Verified still required — restoring the bare cref reproduces it.

Why this still cannot merge

The API is public, but it is still [feature(Feature_ExperimentalApi)], so consuming it pins the whole repo to the -experimental channel. To keep CI meaningful while this is a draft, the branch accepts that, and one change below is deliberately draft-only:

  • The ~25 literal SDK pins now point at 2.6.6-experimental. WinAppSDKReferenceGuardTests requires that no literal pin sits below the central version. That includes 18 recipe files packed into the shipped NuGet agent kit (skills/recipes/, plugins/reactor/skills/reactor-recipes/references/), SKILL.md, the CLI scaffold, and samples. Shipping that would push an experimental SDK onto users, so these must move to the stable version at graduation. That is the main reason this stays a draft.

CI on the experimental channel

The last head before these fixes failed 9 jobs. Each had a narrow cause, and none needed a workflow edit:

failure cause fix
Doc snippet analyzer gate CS8305 from generated code; command-line WarningsNotAsErrors clobbered the project value .editorconfig scoped to XamlTypeInfo.g.cs
Unit tests / coverage: literal-pin guard 25 pins below the central version bumped (draft-only, see above); now 2.6.6-experimental
Unit tests: motion parity guard version-keyed re-verified, not bumped blindly: the four WinUI motion sources have identical blob SHAs at winui3/release/2.2.0 and winui3/release/2.5.4-experimental, and the tag compare is non-empty (300 files) as a positive control
Unit tests: roaming-hive guard its trigger fired for real: on Foundation 2.3.13-experimental, LocalSettings writes the machine-local hive, so WindowsAppSDK#6559 is fixed control now requires exactly one hive; the spec 063 §6 D1 follow-up is now actionable
bootstrap.ps1 NU1107 from the template's stable default none needed any more: since template pack 0.0.8-alpha (#1465) the reactor templates carry no Microsoft.WindowsAppSDK reference, so the scaffold takes the SDK from the local Reactor package. The earlier --wasdk-version workaround was removed (the parameter no longer exists)
Selftests / Packaged / AOT / coverage: LT_*, SlotReplace_*_ChildUnmountedOnce a real, pre-existing Reactor bug, not flakiness and not the SDK (see below) fixed
Packaged: PDM_WrapGrid_Reverse_AllSurvivorsKeepIdentity fixture compared hash codes of wrappers it didn't hold fixed on main by #1434

The .OnUnmount bug. .OnUnmount actions were keyed by the control's managed CsWinRT wrapper, so a GC between mount and unmount silently dropped them. This is pre-existing (the same probe failed on main), not an SDK regression. This branch originally carried a fix, but #1434 fixed it on main independently (with owner tracking and a GC regression test in SlotReplacementFixtures), so the rebase takes main's version and this PR no longer touches the reconciler for it.

Validation

  • On Windows App SDK 2.6.6-experimental, rebased onto main as 6ba6a55a1 (daily sync, Nov 21). WinUI and Runtime moved together per the metapackage nuspec, along with the 24 literal pins. The motion-parity guard is now verified tag-exact: the four motion sources have identical blob SHAs at winui3/release/2.6.6-experimental (55b3fb8f0f) and 2.6.5, and the 2.5.4-experimental → 2.6.6-experimental compare is 300 files as a positive control. Validated locally on 2.6.6: src/Reactor Release 0 errors; SDK guard unit tests 106/106; selftests TXB_ 6, TTV_ 65, KLR_ 73, LT_ 15, SlotReplace_ 228, plus main's new ThemeRefStyle_ 111 (Fix ThemeRef PaneBackground, InteractionStates restore, author Style and key quoting on the Style path #1636) and ThemeRefProbeProcessTests 7 (Resolve ThemeRef through WinUI instead of reading theme dictionaries #1633), all green. CI: 46 pass / 0 fail / 3 skipped on the first run. (Nov 19: the first push failed Build solution and both AOT lanes with REACTORGEN016, fixed then, see above.) (Nov 17 needed one re-run: Packaged Selftests (1/2) failed AnimRemove_Modifier_OpacityIsImmediate, a check added by Fix .Animate() configuration comparison and removal ordering #1499 the day before, which passed in the AOT lane on the same SDK, 8/8 locally, and on re-run.) (Nov 12 needed one re-run of two known timing flakes: RapidClearWait_* in a coverage lane, AutoSuggestBoxCollectedStateTick_HeldOnlyByUnloaded in Selftests (2/2).) On Nov 11, Packaged Selftests (1/2) failed AutoSuggestBoxCollectedStateTick_CallbackAddedLate_TickDelivered. That check has now failed in CI only on the two experimental-SDK branches, so I measured it: it passes 25/25 on an idle machine. Under full CPU load it failed 1/20 on this branch, and also failed on main with the stable SDK (WinUI 2.2.1) in the same interleaved run. The WinUI AutoSuggestBox source differs between stable and experimental only by one accessor, and the 150 ms timer is unchanged. So it is an existing load-sensitive timing check, not an SDK regression.
  • Shard 2 via the exact CI command (REACTOR_SELFTEST_SHARD=2/2 dotnet test tests/Reactor.SelfTests -p:Platform=x64): pre-fix, the new fixture failed 6/6 runs and SlotReplace_RegisteredHostReconcilesChild_Removed_ChildUnmountedOnce reproduced the CI failure (text unmounted 0 times); with the fix, 3/3 green (969/970, 1 intentional skip). Shard 1 green (969/970).
  • src/Reactor Release build (split restore/build): 0 errors.
  • Unit tests touching .OnUnmount (PerfDiffSkipPathTests and related): 56/56. Full Reactor.Tests earlier on this branch: green except the known CompilationLoaderTests.Cold_load_under_500ms timing flake (passes 3/3 isolated).
  • Doc gate exact CI command: exit 0, 0 CS8305.

Before taking this out of draft

  • Wait for the constructor to graduate from [feature(Feature_ExperimentalApi)] to stable, then move both versions onto the stable channel (keeping the metapackage-nuspec pairing rule)
  • Move the ~25 literal pins (agent-kit recipes, SKILL.md, CLI scaffold, samples, perf script) to that stable version
  • Drop the [**/XamlTypeInfo.g.cs] CS8305 section and the REACTORGEN016 section in .editorconfig; both exist only for the experimental channel
  • Re-check whether the IElementFactory cref disambiguation is still needed on the stable SDK
  • Re-verify the motion-parity guard against the stable tag (and update its pinned version)

Related

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🧪 Merged coverage

Coverage for 6ba6a55 vs the base branch (28a8722) — unit + selftest merged.

Metric base PR Δ
Line 88.70% 88.70% 0.00 pp ≈
Branch 45.68% (18380/40239) 45.66% (18382/40255) -0.02 pp ≈

No coverage change beyond the noise floor. ✅

✅ higher / ⚠️ lower / ≈ within noise. Δ is in percentage points; coverage is unit + selftest merged (Debug x64) on the CI runner. Cobertura reports attached to the workflow run as artifacts.

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build metrics

Artifact sizes for 6ba6a55 vs the base branch (28a8722).

Packages (compressed .nupkg)

Artifact base PR Δ
Microsoft.UI.Reactor.nupkg 2.09 MB 2.09 MB +234 B (+0.01%) ≈
Microsoft.UI.Reactor.Advanced.nupkg 528.6 KB 528.6 KB +3 B (0.00%) ≈
Microsoft.UI.Reactor.Devtools.nupkg 287.8 KB 287.8 KB +11 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor

Artifact base PR Δ
Reactor.Analyzers.dll 437.5 KB 437.5 KB +0 B (0.00%) ≈
Reactor.dll 2.83 MB 2.83 MB -512 B (-0.02%) ≈
Reactor.Localization.Generator.dll 16.0 KB 16.0 KB +0 B (0.00%) ≈
Reactor.Wrappers.Abstractions.dll 10.5 KB 10.5 KB +0 B (0.00%) ≈
Reactor.Wrappers.Generator.dll 164.0 KB 164.0 KB +0 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor.Advanced

Artifact base PR Δ
Reactor.Advanced.dll 1.08 MB 1.08 MB +0 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor.Devtools

Artifact base PR Δ
Microsoft.UI.Reactor.Devtools.dll 787.0 KB 787.0 KB +0 B (0.00%) ≈

No size change beyond the noise floor. ✅

✅ smaller / ⚠️ larger / ≈ within noise. Sizes come from a Release dotnet pack on the CI runner: packages are the compressed .nupkg download size, assemblies the uncompressed DLL inside it.
workflow run.

@azchohfi
Alexandre Zollinger Chohfi (azchohfi) force-pushed the azchohfi-winui3-integration-datatemplate branch from 9cfd5c5 to 7b0195f Compare August 25, 2026 22:30
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) force-pushed the azchohfi-winui3-integration-datatemplate branch from 7b0195f to e2c19e1 Compare October 5, 2026 22:17
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) force-pushed the azchohfi-winui3-integration-datatemplate branch from e2c19e1 to a93e826 Compare October 15, 2026 22:10
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) force-pushed the azchohfi-winui3-integration-datatemplate branch 7 times, most recently from 163dd8e to 6ddd295 Compare November 10, 2026 17:07
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) force-pushed the azchohfi-winui3-integration-datatemplate branch 6 times, most recently from 151c75c to 2dfaa00 Compare November 17, 2026 18:28
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) force-pushed the azchohfi-winui3-integration-datatemplate branch 3 times, most recently from d6b1318 to 219f9e7 Compare November 19, 2026 17:53
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Nov 19, 2026
…rsed Style

ApplyThemeBindings built a {ThemeResource} Style as a XAML string, parsed it
with XamlReader.Load, cached it, and assigned fe.Style, which replaced any
Style the app had set. It now calls FrameworkElement.SetThemeResourceBinding
(experimental WinUI API, available on the 2.6.6-experimental channel #1125
moves to) once per property, tracking what it bound on the control's
ReactorState.

The binding sits at local precedence, where the Style sat below it, so the
old winners are preserved explicitly: an explicit brush modifier wins in
either call order, and a local value Reactor did not bind (a .Set setter, an
element property) is left alone. A live binding is not re-installed on an
ordinary render, only on a resource-refresh pass (Theme.NotifyResourcesChanged),
which needs re-resolution of an edited dictionary entry.

InteractionStates used to restore a themed border brush by clearing its local
value so the Style showed through. With the binding now being that local
value, the restore re-installs the binding instead.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0008bac9-a08b-4ee8-9f96-505c6f6f28b0
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) force-pushed the azchohfi-winui3-integration-datatemplate branch from 219f9e7 to 57a068b Compare November 20, 2026 17:08
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Nov 20, 2026
…rsed Style

ApplyThemeBindings built a {ThemeResource} Style as a XAML string, parsed it
with XamlReader.Load, cached it, and assigned fe.Style, which replaced any
Style the app had set. It now calls FrameworkElement.SetThemeResourceBinding
(experimental WinUI API, available on the 2.6.6-experimental channel #1125
moves to) once per property, tracking what it bound on the control's
ReactorState.

The binding sits at local precedence, where the Style sat below it, so the
old winners are preserved explicitly: an explicit brush modifier wins in
either call order, and a local value Reactor did not bind (a .Set setter, an
element property) is left alone. A live binding is not re-installed on an
ordinary render, only on a resource-refresh pass (Theme.NotifyResourcesChanged),
which needs re-resolution of an edited dictionary entry.

InteractionStates used to restore a themed border brush by clearing its local
value so the Style showed through. With the binding now being that local
value, the restore re-installs the binding instead.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0008bac9-a08b-4ee8-9f96-505c6f6f28b0
Reactor built two DataTemplates at runtime by handing XamlReader.Load a markup
string: the ContentControl shell every items control mounts
(ListView/GridView/FlipView), and the legacy text-node TreeView template. Both
existed only because DataTemplate could not be constructed from code.

WinUI now offers `new DataTemplate(DataTemplateElementFactory)`, which takes a
callback returning the subtree. This ports both templates onto it, so Reactor
no longer parses XAML at runtime for item templates.

Beyond removing the parse, the TreeView template loses its
`{Binding Content.Content}`. A classic Binding resolves that path by string
through CsWinRT's ICustomPropertyProvider -- reflection, which NativeAOT trims
unless the source type is annotated, and which costs a reflective lookup per
realized row even when it works. Reading the same chain in a
DataContextChanged handler is strongly typed: no annotation, no lookup, and the
event re-fires on recycling so reused rows retext correctly.

Windows App SDK versions move to the public experimental channel. The API is on
nuget.org but still carries [feature(Feature_ExperimentalApi)], so it exists
only there: it landed in Microsoft.WindowsAppSDK.WinUI 2.3.10-experimental and
is absent from 2.3.9 stable. The 2.5.4-experimental metapackage is the aggregate
that pairs with it (its nuspec names WinUI 2.3.10-experimental and pins Runtime
[2.5.4-experimental]), so the pairing rule in spec 063 section 3 is satisfied
and no package-reference workaround is needed.

Two incidental fixes this SDK requires:

  * CS8305 is demoted from error to warning. The XAML compiler's *generated*
    XamlTypeInfo.g.cs references the SDK's own experimental metadata providers
    (XamlControlsCharts/XamlControlsTabular), so every WinUI project emits it
    from code we do not own. WarningsNotAsErrors rather than NoWarn, so a
    newly-introduced experimental dependency is still reported.
  * The IElementFactory cref in IItemsRepeaterFactorySource is disambiguated.
    This SDK adds Microsoft.UI.Xaml.IElementFactory alongside the existing
    Microsoft.UI.Xaml.Controls.IElementFactory, making the bare cref ambiguous
    (CS0419) and failing the warnings-as-errors Release build. Verified still
    required: restoring the bare cref reproduces the error.

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

Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
Copilot AI added 3 commits November 21, 2026 09:03
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty]
for exactly one reason: Reactor's own text-node TreeView template bound
"Content.Content", and that string path is resolved by reflection, which
NativeAOT trims. The preceding commit replaces that binding with a
DataContextChanged handler, so the reason is gone -- there is now no {Binding}
anywhere in src/ and no SetBinding call site.

The attribute never shipped: every tag to date predates #1108, so no released
build has it, and binding to TreeViewNodeData from a consumer-supplied template
was already broken under NativeAOT in all of them. Removing it therefore takes
away nothing that ever worked in a release; it declines to keep a side effect of
an internal fix. Keeping it would carry a workaround, plus `partial` on a public
record, for a scenario Reactor does not use and does not document.

The limitation is written down instead: docs/aot-support.md gains a row
explaining that a classic {Binding} in a hand-supplied DataTemplate is not
trim-safe, that Reactor's own templates avoid it by populating content in a
DataContextChanged handler, and that a consumer installing their own template
through an escape hatch should do the same or annotate their own type.

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

Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
The experimental channel broke nine CI jobs. None needed a workflow
restructure; each had a narrow cause.

* Doc snippet analyzer gate: the CS8305 exception for the SDK's generated
  XamlTypeInfo.g.cs lived in WarningsNotAsErrors, but this job passes
  -p:WarningsNotAsErrors=NU1900 on the command line, and a global property
  replaces the project value. Moved to an .editorconfig severity scoped to
  **/XamlTypeInfo.g.cs, which global properties cannot clobber. Narrower too:
  CS8305 still fires on Reactor's own experimental API use (verified with a
  probe file).

* REACTORGEN016 (added later by #1583): Microsoft.WinUI on this channel
  ships three XAML metadata providers (Charts and Tabular are the same
  experimental ones behind CS8305; stable ships one), so the wrapper generator
  cannot pick a unique provider for wrappers of built-in WinUI controls and
  warns, which Release turns into an error. Its fallback,
  TryRegisterControlAssembly, is what every wrapper emitted before #1583.
  Downgraded to a suggestion for tests/ and samples/ in .editorconfig; main's
  Release build has no REACTORGEN016, so this hides nothing else.

* Literal SDK pin guard: bumped the 25 literal Microsoft.WindowsAppSDK pins
  (recipes, SKILL.md, CLI scaffold, perf script, samples) to the central
  2.5.4-experimental. These ship in the agent kit, so this branch must stay a
  draft until the API graduates to stable.

* Motion parity guard: re-verified, not bumped blindly. The four WinUI motion
  sources have identical blob SHAs at winui3/release/2.2.0 and
  winui3/release/2.5.4-experimental; the tag compare is non-empty (300 files)
  as a positive control. The new tag is rooted at the repository root rather
  than under src/, so the guard's path-prefix advice is generalized.

* Roaming-hive guard: its trigger fired for real. Measured on the bundled
  runtime (Foundation 2.3.13-experimental, loaded from bin\): LocalSettings now
  writes the machine-local hive, i.e. WindowsAppSDK#6559 is fixed. The control
  now requires the value in exactly one hive, and the store is asserted absent
  from both. The spec 063 D1 follow-up is now actionable.

Coverage jobs failed on the same unit guards and are fixed by the above.

bootstrap needs no change: since template pack 0.0.8-alpha the reactor
templates carry no Microsoft.WindowsAppSDK reference, so the scaffolded app
takes the SDK transitively from the local Reactor package.

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

Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
The 2.6 experimental release (published 2026-11-07) supersedes
2.5.4-experimental. Its metapackage nuspec pairs it with
Microsoft.WindowsAppSDK.WinUI 2.6.6-experimental and exact-pins
Runtime [2.6.6-experimental], so both central values move together per the
spec 063 pairing rule. The code-based DataTemplate constructor is still
[VelocityFeature("Feature_ExperimentalApi")] on microsoft-ui-xaml main, and
absent from every stable WinUI through 2.6.5, so this stays on the
experimental channel.

The 24 literal pins move with the central version, as the literal-pin guard
requires (draft-only: they ship in the agent kit and must go to a stable
version at graduation).

Motion-parity guard re-verified by bracketing, because no
winui3/release/2.6.6-experimental source tag is published yet: the four
motion sources have identical blob SHAs at 2.5.4-experimental, 2.6.4 stable
and main, while 2.5.4-experimental..main changes 300 files.

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

Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) force-pushed the azchohfi-winui3-integration-datatemplate branch from 57a068b to 6ba6a55 Compare November 21, 2026 17:12
Alexandre Zollinger Chohfi (azchohfi) added a commit that referenced this pull request Nov 21, 2026
…rsed Style

ApplyThemeBindings now binds each mapped property (Background, Foreground,
BorderBrush, SplitView.PaneBackground) with FrameworkElement.SetThemeResourceBinding,
the code equivalent of {ThemeResource}, instead of building a Style from a XAML
string. Ownership is tracked per property in ReactorState.ThemeResourceBindings, so
a dropped ThemeRef or a pooled control clears only what Reactor bound, and the
precedence the old Style had (explicit brush modifiers, setters and element
properties win) is kept at local-value precedence.

This replaces the Style path PR #1636 shipped on the stable SDK and keeps its
behavior checks (ThemeRefStyleFixtures). Removed with it: the themed-Style caches,
the ownership marker, the BasedOn base-style stamping and fallback, the
DefaultSplitViewStyle workaround and the unrepresentable-key warning, since no
Style is written and a key needs no quoting. FormatThemeResourceReference stays
for ThemeResourceProbe. InteractionStates keeps main's restore and also puts back
a theme binding the state wrote over, instead of its resolved brush. A key that
changes to one WinUI can't find now releases the property instead of keeping the
previous key's brush.

Stacks on #1125 (experimental Windows App SDK).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0008bac9-a08b-4ee8-9f96-505c6f6f28b0

This branch has not been deployed

No deployments
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