跳到主要内容
版本:11.0.0

Wrap Panel

The wrap panel uses a default arrangement of (multiple) child elements is in sequence from left to right, while they fit in the width. It starts a new line when there is no space left (including any margins and borders).

When the orientation property is set to vertical, the arrangement is top to bottom with a new column started when there is no more height remaining.

Useful Properties

You will probably use these properties most often:

PropertyDescription
OrientationChange the direction of the arrangement flow.

Examples

<WrapPanel>
<Rectangle Fill="Navy" Width="100" Height="100" Margin="20"/>
<Rectangle Fill="Yellow" Width="100" Height="100" Margin="20"/>
<Rectangle Fill="Green" Width="100" Height="100" Margin="20"/>
<Rectangle Fill="Red" Width="100" Height="100" Margin="20"/>
<Rectangle Fill="Purple" Width="100" Height="100" Margin="20"/>
</WrapPanel>
<WrapPanel Orientation="Vertical">
<Rectangle Fill="Navy" Width="100" Height="100" Margin="20"/>
<Rectangle Fill="Yellow" Width="100" Height="100" Margin="20"/>
<Rectangle Fill="Green" Width="100" Height="100" Margin="20"/>
<Rectangle Fill="Red" Width="100" Height="100" Margin="20"/>
<Rectangle Fill="Purple" Width="100" Height="100" Margin="20"/>
</WrapPanel>

More Information

信息

For the complete API documentation about this control, see here.

信息

View the source code on GitHub WrapPanel.cs