Skip to content

chore(winui-sync): Onboard Expander at WinUI 2.7.0 - #26601

Merged
MartinZikmund merged 6 commits into
masterfrom
dev/mazi/winui-sync-expander
Nov 23, 2026
Merged

MartinZikmund merged 6 commits into
masterfrom
dev/mazi/winui-sync-expander

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes unoplatform/uno-private#2618

PR Type:

🔄 Refactoring (WinUI sync onboarding)

What changed? 🚀

Onboards Expander (id: expander) to the weekly WinUI port sync. The port was brought up to winui3/release/2.7.0, reviewed against it line by line, and its Uno workarounds were audited. The area is then recorded in build/winui-sync/areas/expander.json at that tag.

Starting point

seed-area.ps1 header refs: winui3/release/1.4.2 ×3, 8d20a91 ×2, winui3/release/1.8.4 ×1, winui3/release/2.5.1 ×1.

  • 8d20a91 (2021, on Expander.Properties.cs / ExpanderTemplateSettings.cs) predates the controls/dev layout, so it was treated as an outlier. Both files match the 2.7.0 generated properties (Expander.properties.cpp, ExpanderTemplateSettings.properties.cpp): same DPs, same defaults, same callbacks.
  • Starting point: winui3/release/1.4.2 (7198c4e690).
  • ExpandDirection.cs and the two event-args files had no recorded ref. They are generated from Expander.idl and match it; a header now names it.

Catch-up 1.4.2 → 2.7.0

The upstream diff touched 6 files (+450/−5). Most of it is the perf2026 XAML variants.

Upstream change Verdict
Expander.cpp: NegativeContentHeight(-1 * static_cast<double>(height)) Ported (already equivalent: C# height is already double)
ExpanderAutomationPeer.cpp: control type Group → Button Ported (already present via the 1.8.4 sync)
Expander_perf2026.xaml, Expander_themeresources_perf2026.xaml Not applicable (perf2026 opt-in variants Uno does not use)
Expander.vcxitems Not applicable (build file)

Nothing was skipped, so no skipped-items issue was needed. Theme XAML (Expander.xaml, Expander_themeresources.xaml) matches 2.7.0 apart from the header.

Line-by-line review (vs 2.7.0)

Upstream Uno Result
Expander.h/.cpp Expander.cs UpdateExpandState used peer as … ?.; it now casts like upstream's peer.as<>(). GetNameCore() → GetName() is kept and marked (GetNameCore is protected in C#; GetName forwards to it). The rest matches.
Expander.idl + Generated/Expander.properties.cpp Expander.Properties.cs, ExpandDirection.cs, Expander*EventArgs.cs Matches (DPs, defaults, callbacks, events, enum values). Fixed the copy-pasted XML doc on IsExpanded.
ExpanderTemplateSettings.h/.cpp + generated properties ExpanderTemplateSettings.cs Matches
ExpanderAutomationPeer.h/.cpp ExpanderAutomationPeer.cs GetPeerFromPointCore silently skipped focusing a non-ToggleButton header; it now casts like upstream. Kept and marked: null guards on the C# GetChildrenCore(), the empty-list early return (upstream would size a vector at -1), and GetChildren() for the protected GetChildrenCore(). Added the missing upstream comment. GetImpl is unused upstream and not applicable.
APITests/ExpanderTests.cs ExpanderTests_APITests.mux.cs 1/1 ported. The commented-out AutomationProperties.Name check is re-enabled and passes.
InteractionTests/ExpanderTests.cs ExpanderTests_InteractionTests.mux.cs Before this PR the whole file was a commented copy of an older upstream version. Now ExpandCollapseAutomationTests and AutomationPeerTest (2.7.0 version, including the new focus asserts) are ported as runtime tests that drive the automation peers. VerifyAxeScanPasses is not ported: Uno has no Axe infrastructure.

Workaround audit

Location What it did Verdict Evidence
Expander.OnApplyTemplate / OnContentClipSizeChanged Replaced the composition InsetClip with a RectangleGeometry clip updated on SizeChanged Removed: upstream CreateInsetClip() restored InsetClip is implemented on Skia. The new Given_Expander.When_Content_Translated_Over_Header_Then_Clipped passes with the clip and fails without it (red content bleeds into the header at (100, 38)).
Expander ctor Loaded/Unloaded + _eventSubscriptions Unsubscribed on unload and re-ran OnApplyTemplate on reload, for an iOS native-view leak Removed: the SizeChanged handler is revoked on re-template like upstream's auto_revoke revoker That leak was specific to the native iOS renderer, which no longer exists. Given_FrameworkElement_And_Leak.When_Add_Remove(Expander) passes.
// Uno Doc: EventSource is not implemented Stale note Removed AutomationPeer.EventsSource is implemented
HeaderTemplate metadata ValueDoesNotInheritDataContext Uno DP option for DataTemplate properties Kept Standard Uno convention for template-typed DPs; no behaviour difference against WinUI
C# access markers in Expander.cs / ExpanderAutomationPeer.cs See review table Kept Protected members can't be called on another instance in C#

Tests (Skia desktop, Release)

  • ExpanderTests.ExpanderAutomationPeerTest, ExpanderInteractionTests.ExpandCollapseAutomationTests, ExpanderInteractionTests.AutomationPeerTest, Given_Expander.When_Content_Translated_Over_Header_Then_Clipped: pass, 5 iterations each with retries disabled. The clip test is excluded on WinAppSDK: it guards Uno's Skia InsetClip, and there the Expander is still header-sized (48 px) when the screenshot is taken.
  • Given_FrameworkElement_And_Leak.When_Add_Remove (all rows, including Expander), Given_Control.When_CCExpander_*, Given_AriaMapper.When_Expander_Then_Expanded_Without_HasPopup: pass (92 total).
  • Uno.UI.RuntimeTests.Generic builds clean without UnoFastDevBuild (analyzers on).
  • detect.ps1: expander reports up to date. build/winui-sync/tests/run.ps1: 133 passed.

No project or MSBuild files changed.

PR Checklist ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01TXMNu2vyo2nCA7nYdY9GPd

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 15s —— View job


Review of #26601: Onboard Expander to WinUI sync

Verdict: ship. No blocking issues. I read the diff only. I did not build it or run tests, so the test results in the PR description are taken as stated.

Findings: 0 blocking, 0 major, 2 minor (nits, no inline comments posted).

  • Minor, Expander.cs: there is a stray blank line before the closing brace of the class, left over from removing the Loaded/Unloaded handlers. The analyzers may flag it on CI.
  • Minor, hard casts: UpdateExpandState and ExpanderAutomationPeer.GetPeerFromPointCore now cast like upstream.
    • A subclass that overrides OnCreateAutomationPeer and returns a non-ExpanderAutomationPeer would now throw InvalidCastException instead of silently skipping the call. The same applies to a custom ToggleButton peer that is not a FrameworkElementAutomationPeer.
    • This matches WinUI, so it is acceptable. Consider mentioning it in the workaround table as a deliberate parity change.

What I checked:

  • Removing the RectangleGeometry clip and restoring CreateInsetClip() is backed by Given_Expander.When_Content_Translated_Over_Header_Then_Clipped, which your description says fails without the clip.
  • Removing the Loaded/Unloaded re-subscription is justified, since the leak was specific to the iOS native renderer that no longer exists.
  • The Uno specific: markers on the kept deviations (null guards, GetName and GetChildren forwarders) are clear.
  • The areas.json entry is consistent with the other areas.
  • Header-only edits to the theme XAML and event-args files are fine.
  • No new event Action, no #if platform code, no edits under Generated/, and no skipped or ignored tests.
  • Reminder: Axe is not ported (VerifyAxeScanPasses). You already documented that.

@mergify

mergify Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label Nov 19, 2026
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/winui-sync-expander branch from 3355084 to 92ef5b1 Compare November 22, 2026 21:49
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 19s —— View job


Review of #26601: Onboard Expander to WinUI sync

Verdict: ship (with one trivial nit).

Issues: 0 blocking, 0 major, 1 minor (inline comment posted).

Scope of this review: I read the diff for Expander.cs, ExpanderAutomationPeer.cs and Given_Expander.cs. I did not build the project or run tests, so the test results in the description are taken as stated.

Cross-cutting notes

  • The hard casts in UpdateExpandState and GetPeerFromPointCore now match upstream. They are a deliberate parity change. A subclass that returns a non-ExpanderAutomationPeer from OnCreateAutomationPeer would now throw InvalidCastException. Consider adding a line about this to the workaround audit table.
  • Removing the RectangleGeometry clip and restoring CreateInsetClip() is covered by a red/green runtime test, When_Content_Translated_Over_Header_Then_Clipped.
  • The Uno specific: markers on the kept deviations are clear.
  • No event Action, no platform #if, no Generated/ edits, and no skipped or ignored tests.
  • The Azure DevOps comment reports about 240–265 screenshot diffs across unrelated samples (Border, Basics and others). That is far more than this change should cause, so it is probably baseline drift or flakiness. Please confirm it also shows up on other PRs and check the Expander-related screenshots.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 248281 found UI Test snapshots differences: skia-linux-screenshots: 216, skia-windows-screenshots: 281

Details
  • skia-linux-screenshots: 216 changed over 2500

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AutomationPropertiesExtensions_Role.png-dark
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • CalendarView_Theming.png-dark
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AnimatedBackVisualSourceSamplePage.png
    • AutomationPropertiesExtensions_Role.png
    • AutomationProperties_AutomationId.png-dark
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • AnimatedVisualsTestbedPage.png-dark
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • AutomationProperties_StructureAndProps.png-dark
    • AutomationProperties_StructureAndProps.png
    • Basics.png-dark
  • skia-windows-screenshots: 281 changed over 2500

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png-dark
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • AutomationProperties_AutomationId.png-dark
    • CalendarView_Theming.png-dark
    • AutomationProperties_AutomationId.png
    • AutomationProperties_StructureAndProps.png-dark
    • Basics.png-dark
    • Basics.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • Accessibility_Showcase.png-dark
    • AnimatedBackVisualSourceSamplePage.png
    • BasicAcrylicBrushTest2.png-dark
    • BasicAcrylicBrushTest2.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • CornerRadiusControls.png-dark

@unoplatform unoplatform deleted a comment from nventive-devops Nov 23, 2026
@unoplatform unoplatform deleted a comment from unodevops Nov 23, 2026
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/winui-sync-expander branch from 6fe4326 to 7e136b0 Compare November 23, 2026 07:46
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 14s —— View job


Review of #26601: Onboard Expander to WinUI sync

Verdict: ship.

Issues: 0 blocking, 0 major, 0 minor. No new inline comments.

Scope: I read the current head (7e136b0d) of Expander.cs. The earlier stray-blank-line nit is fixed, and the file now ends cleanly after UpdateExpandState. I did not build the project or run tests, so the test results in the description are taken as stated.

Cross-cutting notes

  • The hard casts in UpdateExpandState and GetPeerFromPointCore now match upstream. A subclass whose OnCreateAutomationPeer returns a non-ExpanderAutomationPeer would now throw InvalidCastException. This is a deliberate parity change, and it would help to add a line about it to the workaround audit table.
  • The screenshot diffs reported by CI (216 on Linux, 281 on Windows) are spread across unrelated samples such as Border, Basics and BenchmarkDotNet. That is far more than this change could cause. Please confirm the same diffs appear on other recent PRs before merging.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 14s —— View job


Review of #26601: Onboard Expander to WinUI sync

Verdict: ship.

Issues: 0 blocking, 0 major, 0 minor. No inline comments posted.

Scope: I read the diff of Expander.cs on the current head (3f755483). I did not build the project or run tests, so the test results in the description are taken as stated.

Checked

  • The stray blank line from the earlier review is gone. The file ends cleanly after UpdateExpandState.
  • OnApplyTemplate now uses CreateInsetClip() directly. m_expanderContentSizeChangedRevoker is reset to null before re-subscribing, so the SizeChanged handler is revoked on re-template. This replaces the removed Loaded/Unloaded workaround.
  • The Uno specific: marker on the GetName forwarder is clear.
  • No new event Action, no platform #if or suffix code in Uno.UI, and no edits under Generated/.
  • The last commit skips the InsetClip test on WinAppSDK. That is a platform condition, not a deactivated test.

Cross-cutting notes

  • The hard casts in UpdateExpandState and GetPeerFromPointCore now match upstream. A subclass whose OnCreateAutomationPeer returns a non-ExpanderAutomationPeer would now throw InvalidCastException. This is a deliberate parity change. A line about it in the workaround audit table would help.
  • CI reports 216 screenshot diffs on Linux and 281 on Windows. They are spread across unrelated samples such as Border, Basics and BenchmarkDotNet, which this change cannot plausibly affect. Please confirm the same diffs appear on other recent PRs before merging.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

MartinZikmund and others added 6 commits November 23, 2026 09:30
The upstream changes since 1.4.2 were already in the port. The review
against 2.7.0 aligns the remaining gaps: the automation event raise and
GetPeerFromPointCore cast like upstream, and the unavoidable C# access
differences are marked. Headers name their upstream files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu2vyo2nCA7nYdY9GPd
- Restore the composition InsetClip on ExpanderContentClip; InsetClip is
  implemented on Skia, so the SizeChanged + RectangleGeometry stand-in
  is no longer needed.
- Drop the Loaded/Unloaded resubscription added for an iOS native-view
  leak; the content SizeChanged handler is revoked on re-template like
  upstream's auto_revoke. The Expander leak test passes without it.
- Drop the stale note that AutomationPeer.EventsSource is unimplemented.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu2vyo2nCA7nYdY9GPd
- Port the two interaction tests (ExpandCollapseAutomationTests,
  AutomationPeerTest) as runtime tests driven through the automation
  peers; VerifyAxeScanPasses has no Uno equivalent.
- Re-enable the AutomationProperties.Name check in the API test.
- Add a screenshot test for the restored content clip.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu2vyo2nCA7nYdY9GPd
Record the Expander area at winui3/release/2.7.0. Detection reports it
up to date.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu2vyo2nCA7nYdY9GPd
It guards Uno's InsetClip on Skia; on WinAppSDK the Expander is still
header-sized when the screenshot is taken, so the probe falls outside it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNtzaC5dx4oo2ZVG5BHB
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/winui-sync-expander branch from 3f75548 to 4fed11b Compare November 23, 2026 08:34
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 16s —— View job


Review of #26601: Onboard Expander to WinUI sync

Verdict: ship.

Issues: 0 blocking, 0 major, 0 minor. I posted no inline comments.

Scope: I read the current origin/master...HEAD diff of Expander.cs and Given_Expander.cs. I did not build the project or run tests, so the test results in the description are taken as stated.

Checked

  • The stray blank line from the earlier review is gone, and Expander.cs ends cleanly after UpdateExpandState.
  • OnApplyTemplate now calls CreateInsetClip() directly, as upstream does. The RectangleGeometry workaround is removed, and When_Content_Translated_Over_Header_Then_Clipped covers it.
  • m_expanderContentSizeChangedRevoker is reset to null before re-subscribing, so the SizeChanged handler is revoked on each re-template. This replaces the Loaded/Unloaded workaround. The template child belongs to the Expander, so the handler no longer needs to be dropped on unload.
  • The new test is skipped on WinAppSDK through PlatformCondition, not [Ignore]. It has a stated reason.
  • The Uno specific: markers on the kept deviations are clear.
  • No new event Action, no platform #if or suffix code in Uno.UI, and no edits under Generated/.

Cross-cutting notes

  • The hard casts in UpdateExpandState and GetPeerFromPointCore match upstream. A subclass whose OnCreateAutomationPeer returns a non-ExpanderAutomationPeer would now throw InvalidCastException. This is a deliberate parity change, and a line about it in the workaround audit table would help.
  • CI reports 216 screenshot diffs on Linux and 281 on Windows. They are spread across unrelated samples such as Border, Basics and BenchmarkDotNet. This change cannot plausibly cause that. Please confirm the same diffs appear on other recent PRs. Also check any Expander-specific screenshots, since the clip implementation changed.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 248334 found UI Test snapshots differences: skia-linux-screenshots: 216, skia-windows-screenshots: 289

Details
  • skia-linux-screenshots: 216 changed over 2502

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png-dark
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • AnimatedVisualsTestbedPage.png-dark
    • Basics.png-dark
    • Basics.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • AnimatedBackVisualSourceSamplePage.png
    • AutomationProperties_StructureAndProps.png-dark
    • AutomationProperties_StructureAndProps.png
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • Accessibility_Showcase.png
    • AppWindowTitleBar Properties.png-dark
    • AutomationProperties_AutomationId.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
  • skia-windows-screenshots: 289 changed over 2502

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png
    • AnimatedVisualsTestbedPage.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • AutomationProperties_StructureAndProps.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Accessibility_Showcase.png-dark
    • AnimatedBackVisualSourceSamplePage.png
    • AnimatedVisualsTestbedPage.png-dark
    • BasicAcrylicBrushTest2.png-dark

@MartinZikmund
MartinZikmund merged commit 7858ac8 into master Nov 23, 2026
52 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/winui-sync-expander branch November 23, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants