Docking fails for the last item

When I try to Dock 3 items to the top, only the first 2 correctly dock to the top. The 3rd item stays in the middle?

<DockPanel>
    <Rectangle DockPanel.Dock="Top" WidthUnit="Pixels" Fill="Red" HeightUnit="Pixels" Width="100" Height="100" />
    <Rectangle DockPanel.Dock="Top" WidthUnit="Pixels" Fill="Red" HeightUnit="Pixels" Width="100" Height="100" />
    <Rectangle DockPanel.Dock="Top" WidthUnit="Pixels" Fill="Red" HeightUnit="Pixels" Width="100" Height="100" />
</DockPanel>

actually ignore this, i believe it’s just my lack of understanding on how DockPanel works… I assumed it would Dock ALL the rectangles to the top

Hi!

Yes, this is currently expected behavior, but we are aware that it can be a bit WTF.

The DockPanel has a setting called LastChildFill which defaults to true.

Do

<DockPanel LastChildFill="false">

to disable that.

As this has been reported as confusing many times before, we might change the API.

Thanks for reporting :slight_smile: