Using the WrapPanel layout panel

Cc295081.bf9c77b1-ba7a-4f3b-8380-d05728d208d1(en-us,Expression.40).png

A WrapPanel layout panel in a Windows Presentation Foundation (WPF) project is similar to a StackPanel layout panel, but it allows objects to be placed on multiple lines. When an object overflows off the edge of the panel, it will not be clipped, but instead will be wrapped to the next line. As you add more child objects, the WrapPanel layout panel will continue to wrap the objects until it runs out of space. Only then will it clip the objects.

By default, the objects within a WrapPanel layout panel are placed horizontally from left-to-right, top-to-bottom, but you can also place them vertically from top-to-bottom, left-to-right. Change the Orientation property for a WrapPanel layout panel within the Properties panel under Layout.

Add a WrapPanel to a document by selecting WrapPanel Cc295081.91486eda-6173-4ce8-9610-4f296dcb83d7(en-us,Expression.40).png from the Assets panel Cc295081.0d8b8d29-1af9-418f-8741-be3097d76eab(en-us,Expression.40).png or from the layout container button in the Tools panel, and then dragging on the artboard. The following XAML code is added to your project:

<Grid x:Name="LayoutRoot">
   <WrapPanel HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="100"/>
</Grid>

Objects in a WrapPanel

Cc295081.b1c415fb-9a32-4a18-aa0b-308fca994ac9(en-us,Expression.40).png

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.