Repository navigation
fix(pivot): Measure PivotItem content with the Pivot's width (port PivotPanel) - #25143
Merged
Merged
Conversation
Port WinUI's PivotPanel measure/arrange (PivotPanel_Partial.cpp) and use it as the Pivot template's "Panel", as WinUI does. Pivot hands its available width to the panel as the section width, so items are no longer measured with the infinite width of the template's ScrollViewer and wrapping text wraps instead of being clipped. Fixes #21729 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01E8bkzyS24p8CYDWLUPsaPC
Contributor
|
Claude finished @MartinZikmund's task in 27s —— View job PR review: Pivot / PivotPanel portVerdict: ship, with one low-severity item.
I read the diff by inspection only. I did not build or run tests, so the runtime results in the PR description are the author's, not mine. What looks good
Cross-cutting notes
|
Contributor
|
The build 238482 found UI Test snapshots differences: Details
|
Member
Author
|
Follow-up on the review summary and the screenshot report:
|
This was referenced Oct 16, 2026
1 of 10 tasks
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.
GitHub Issue: closes #21729
Related: #3596
PR Type:
🐞 Bugfix
What changed? 🚀
Before: Content inside a
PivotItemwas measured with infinite width, soTextBlock/RichTextBlock/TextBoxwithTextWrapping="Wrap"never wrapped and got clipped. Uno's Pivot template had a plain<Grid x:Name="Panel">inside the template'sScrollViewer(horizontal scrolling allowed, so infinite width). WinUI uses<PivotPanel x:Name="Panel">there.PivotPanel::MeasureOverrideImplmeasuresPivotLayoutElementwith the Pivot's section width, "to lay out the PivotItems with a fixed size, even though we're in a ScrollViewer that will measure with infinite extents".After:
PivotPanel: ported measure/arrange fromdxaml/phone/lib/PivotPanel_Partial.cpp/.h(commit4a1c6184c) intoPivotPanel.partial.mux.cs/PivotPanel.partial.h.mux.cs. This replaces Uno's oldPivotPanel, which was never used by any template and read the viewport size from the parentScrollViewer.Pivot:MeasureOverride/ArrangeOverridenow replace an infinite width with theXamlRootwidth (Pivot::GetScreenWidth) and pass the measure width to the panel throughSetSectionWidth. This stands in forPivotStateMachine::MeasureEventand uses the same 0.1AreClosethreshold.OnApplyTemplatewiresSetParentPivot.c_*Nametemplate part constants andGetPivotPanelMultiplier.Generic.xamland FluentPivot_themeresources.xamlnow use<PivotPanel x:Name="Panel">, matching WinUI. This also removes the FluentUNO TODOaboutPivotPanelinPivotonly shows one header #3596. That header bug does not reproduce with the ported panel (see tests and the manual check below).Deliberate deviations (marked
TODO Uno):Pivot.GetPivotPanelMultiplierImpl()returns1instead of WinUI's1000(carousel) or item count. Uno'sPivotswitches items by togglingVisibilityand never pans theScrollViewerbetween sections. A 1000x-wide extent would only let users scroll into empty space, so the panel spans exactly one section.IScrollSnapPointsInfo(snap points) andInvalidateHeaderSecondaryContentRelationshipsare kept as#if !HAS_UNOfor the same reason. The generatedNotImplementedsnap-point stubs are unchanged.I chose the faithful port over a smaller Uno-specific clamp so the template and
Panelcontract match WinUI. That gives a base for porting the panning state machine later.Validation
Runtime (Skia desktop,
Given_Pivot, net10.0-desktop Release):When_PivotItem_Has_Wrapping_Text_Then_Measured_With_Pivot_Widthfailed for bothinScrollViewervariants.Given_Pivottests pass. I also ranKeyboardAcceleratorTests, which includesValidateKeyboardAcceleratorToolTipsOnPivot: 54 total, 54 passed, 0 failed (9 skipped by existing attributes).When_Multiple_Items_Then_Headers_Not_Stretchedis a regression guard forPivotPanelinPivotonly shows one header #3596 and passes with thePivotPaneltemplate.Manual: in SamplesApp,
Pivot/Basics Pivot Testrenders all four headers (First/Second/Third/Fourth) side by side with no stretched header.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
https://claude.ai/code/session_01E8bkzyS24p8CYDWLUPsaPC