-api-id | -api-type |
---|---|
T:Microsoft.UI.Xaml.Controls.WrapGrid |
winrt class |
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.
<WrapGrid ...>
oneOrMoreUIElements
</WrapGrid>
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 1 | Item 4 | Item 7 |
Item 2 | Item 5 | Item 8 |
Item 3 | Item 6 | Item 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 1 | Item 2 | Item 3 |
Item 4 | Item 5 | Item 6 |
Item 7 | Item 8 | Item 9 |
OrientedVirtualizingPanel, IScrollSnapPointsInfo, ItemsControl.ItemsPanel, ItemsPanelTemplate, List view and grid view