Skip to content

Fix pending WrapPanel layout bugs - #11507

Open
Niels Laute (niels9001) wants to merge 3 commits into
microsoft:mainfrom
niels9001:fix/wrappanel-wct-bugfixes
Open

Niels Laute (niels9001) wants to merge 3 commits into
microsoft:mainfrom
niels9001:fix/wrappanel-wct-bugfixes

Conversation

@niels9001

@niels9001 Niels Laute (niels9001) commented Aug 11, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Ports the two remaining Community Toolkit WrapPanel fixes that were identified during the WinUI API-review follow-up but were still pending in the WinUI implementation:

  • Avoid stretching the last item to an infinite size when the panel is measured with an unconstrained primary axis.
  • Start a new line when the current line exactly fills the available primary-axis space, allowing a zero-desired-size final item to wrap and stretch correctly.

The API naming updates from #10858 were already completed; this PR closes the remaining behavioral gaps from the original Community Toolkit implementation:

Both original fixes and their tests were authored by @AndrewKeepCoding. This WinUI port retains that attribution in the commit metadata.

Testing

Added API regression coverage for both horizontal and vertical orientations, covering infinite primary-axis measurement and exact-boundary wrapping with ItemsStretch="Last".

@niels9001
Niels Laute (niels9001) requested a review from a team as a code owner August 11, 2026 09:31
@microsoft-github-policy-service microsoft-github-policy-service Bot added the needs-triage Issue needs to be triaged by the area owners label Aug 11, 2026
Port the remaining Community Toolkit fixes for infinite-axis stretching and exact-boundary wrapping, with horizontal and vertical regression coverage.

Original fixes authored by AndrewKeepCoding in CommunityToolkit/Windows PRs microsoft#704 and microsoft#759.

Co-authored-by: AndrewKeepCoding <80524586+AndrewKeepCoding@users.noreply.github.com>

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

Copilot-Session: 51f05dcb-e574-492d-ba19-1e35322cab67

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 ports two pending Windows Community Toolkit WrapPanel behavior fixes into WinUI’s WrapPanel implementation, addressing edge cases around ItemsStretch="Last" when the primary axis is unconstrained (infinite) and when a line exactly fills the available space.

Changes:

  • Prevent stretching the last item to an infinite size when the panel is measured with an unconstrained primary axis.
  • Force a wrap when the current line exactly fills the available primary-axis space, enabling correct wrapping/stretching for a zero-desired-size final item.
  • Add API regression tests covering both horizontal/vertical orientations for the above scenarios.

Reviewed changes

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

File Description
controls/dev/WrapPanel/WrapPanel.cpp Updates wrap and stretch logic to handle infinite primary-axis measurement and exact-boundary wrapping.
controls/dev/WrapPanel/APITests/WrapPanelTests.cs Adds regression tests for infinite primary-axis measure and exact-boundary wrap behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread controls/dev/WrapPanel/WrapPanel.cpp
Comment thread controls/dev/WrapPanel/APITests/WrapPanelTests.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Include end padding in the exact-boundary wrap check and cover horizontal and vertical zero-sized last-child layouts.

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

needs-triage Issue needs to be triaged by the area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants