Skip to content

New row not created for last child in WrapPanel when StretchChild=Last #743

@michael-hawker

Description

@michael-hawker

As I was writing up the spec for the WinUI transfer and looking at primitive examples and was a bit baffled at what was happening with StretchChild and my intuitive expectations...

Take this code:

    <controls:WrapPanel Width="132" StretchChild="Last">
        <Rectangle Fill="Red" Width="45" Height="44"/>
        <Rectangle Fill="Blue" Width="44" Height="44"/>
        <Rectangle Fill="Green" Width="44" Height="44"/>
        <Rectangle Fill="Orange" Height="44"/>
    </controls:WrapPanel>

This properly stretches the last item across the bottom:

image

However, if we make enough room for the green box on the first row (by making the red 44 width [only change])...

    <controls:WrapPanel Width="132" StretchChild="Last">
        <Rectangle Fill="Red" Width="44" Height="44"/>
        <Rectangle Fill="Blue" Width="44" Height="44"/>
        <Rectangle Fill="Green" Width="44" Height="44"/>
        <Rectangle Fill="Orange" Height="44"/>
    </controls:WrapPanel>

Actual: Then the Orange rect disappears entirely!

image

Expected: I would expect it to span the entire bottom row, like so:

image

This is the behavior we should at least make sure works, and have a test for. FYI @azchohfi as we'll need to port whatever fixes we make here to WinUI as well. I'm going to spec it up as I expect it to work for now.

Originally posted by @michael-hawker in #704 (comment)

Metadata

Metadata

Labels

bugSomething isn't workingcomponents::controls::primitivesPrimitive layout controls such as SwitchPresenter, UniformGrid, WrapLayout, StaggeredPanel, etc.testing 🏗

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions