Repository navigation
fix(flexpanel): size an inner panel to its content when it is a flex item (backport #1676) - #1677
Merged
Merged
Conversation
…item (#1676) * fix(flexpanel): size an inner panel to its content when it is a flex item - a FlexPanel measured by a parent FlexPanel for content (AtMost/Undefined width) no longer fills the offered width; it was taking the whole line and leaving its Grow siblings with nothing - mirrors the existing height-axis handling (_parentFlexHeightMode) for the width axis; HorizontalAlignment != Stretch still opts into fit-content - tests: inner row item sized to content, growing inner item fills its share, inner panel in a centered column hugs its content * refactor(flexpanel): name the height content flag after its axis - outerFlexWantsContent becomes outerFlexWantsContentHeight beside the width one - the measure-function comment now says both modes are handed to the child * test(flexpanel): guard nested-panel sizing on both paths - inner row item is content-sized with and without Shrink=0 - inner panel in a default stretch column still fills it - centered inner panel's actual width hugs its content - nested Grow rows keep each level at two measures or fewer * docs(flexpanel): explain how nested panels size (cherry picked from commit 73f4621)
3 of 4 tasks
Xiaoy312
approved these changes
Oct 14, 2026
Contributor
Author
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Closed
1 task done
Merged
1 task done
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 (If applicable): closes #1675
PR Type
What is the current behavior?
A
FlexPanelplaced directly inside anotherFlexPanelfills the width it is offered, even when the parent only measures it for its content (flex-basis resolution, or a non-stretch cross axis). In a row it takes the whole line, so itsGrowsiblings get no width; in a centered column it is full width instead of hugging its content. Details and repro in #1675.Out of scope: an inner panel behind another panel (
StackPanel,Border,Grid) still fills what that panel hands it — the parent-mode signal deliberately does not cross a non-FlexPanel, asWhen_InnerFlexPanelUnderGridRow_ThenFillsDefiniteSlotalready asserts.HorizontalAlignment="Left"on the inner panel remains the opt-out there.What is the new behavior?
As a flex item, an inner panel's base size is its content, as in CSS.
MeasureCorenow treats the width axis like the height axis already is: when the parentFlexPanelmeasures a direct child withAtMost/Undefinedwidth, the child reports its content width instead of the cap.Exactly(stretch, or a resolved grow share) still fills, andHorizontalAlignment != Stretchis still thefit-contentopt-in.The change is the width twin of
_parentFlexHeightMode: one more field, set by the parent's measure function on directFlexPanelchildren only, with the same invalidation when the mode changes.New runtime tests:
When_InnerFlexPanelIsRowItem_ThenSizedToContentAndGrowSiblingGetsRemainder(with and withoutShrink=0) — 80/520 instead of 600/0When_InnerFlexPanelIsGrowingRowItem_ThenFillsItsShare— 500 instead of 515When_InnerFlexPanelInCenteredColumn_ThenSizedToContent— 80 instead of 600When_InnerFlexPanelInStretchColumn_ThenFillsCrossAxis— guard: the default stretch column still fills (600)When_NestedRowsWithGrowSiblings_ThenMeasureCountDoesNotCompound— guard: five nested Grow rows stay at two measures or fewer per levelThe first three fail without the fix.
doc/controls/FlexPanel.mdgains a "Nesting FlexPanels" section: content-sized in a row unless grown, filled in a stretch column, andHorizontalAlignment="Left"when another panel sits in between.Behaviour change to note in the release: an inner
FlexPanelthat is not grown, or sits in a column withAlignItems/AlignSelfother thanStretch, now hugs its content instead of spanning the line. Restore the old fill withGrow="1"orAlignSelf="Stretch".PR Checklist
FlexPanelTestspass in the Material sample appservicing/10.0(FlexPanel shipped there via feat: FlexPanel (backport #1639) #1658) once this is reviewedThis is an automatic backport of pull request #1676 done by [Mergify](https://mergify.com).