Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 2.6 KB

File metadata and controls

54 lines (37 loc) · 2.6 KB
-api-id -api-type
T:Microsoft.UI.Xaml.Controls.WrapGrid
winrt class

Microsoft.UI.Xaml.Controls.WrapGrid

-description

Positions child elements sequentially from left to right or top to bottom. When elements extend beyond the container edge, elements are positioned in the next row or column. Can only be used to display items in an ItemsControl. See Remarks.

-xaml-syntax

<WrapGrid ...>
  oneOrMoreUIElements
</WrapGrid>

-remarks

Important

ItemsWrapGrid is used as the default ItemsPanel for GridView. If you modify the ItemsPanel, we recommend you use ItemsStackPanel or ItemsWrapGrid instead of VirtualizingStackPanel or WrapGrid.

WrapGrid can only be used to display items in an ItemsControl.

The content of a WrapGrid is virtualized. This can improve performance when you work with large data sets. For more info, see Optimize ListView and GridView.

In a WrapGrid, elements are arranged in rows or columns that automatically wrap to a new row or column when the MaximumRowsOrColumns value is reached. The Orientation property specifies whether the grid adds its items in rows or columns before wrapping.

When the value is Vertical, the grid adds items in columns from top to bottom, then wraps from left to right, like this:

Item 1Item 4Item 7
Item 2Item 5Item 8
Item 3Item 6Item 9

When the value is Horizontal, the grid adds items in rows from left to right, then wraps from top to bottom, like this:

Item 1Item 2Item 3
Item 4Item 5Item 6
Item 7Item 8Item 9

-examples

-see-also

OrientedVirtualizingPanel, IScrollSnapPointsInfo, ItemsControl.ItemsPanel, ItemsPanelTemplate, List view and grid view