-api-id | -api-type |
---|---|
T:Windows.UI.Xaml.Controls.ItemsWrapGrid |
winrt class |
Positions child elements sequentially from left to right or top to bottom in an ItemsControl that shows multiple items. When elements extend beyond the container edge, elements are positioned in the next row or column. Supports pixel-based UI virtualization and grouped layouts.
<ItemsWrapGrid .../>
ItemsWrapGrid can be used only as the ItemsPanel of an ItemsControl that displays more than one item at a time. It can't be used with an ItemsControl that displays only one item at a time, such as a ComboBox or FlipView. ItemsWrapGrid is the default ItemsPanel for GridView.
In an ItemsWrapGrid, elements are arranged in rows or columns that automatically wrap to a new row or column when the elements reach the container edge. If the MaximumRowsOrColumns property is set, items wrap when the specified number of rows or columns is reached instead.
You set the Orientation property to specify whether the grid adds its items in rows or columns before wrapping. The default is Orientation.Vertical.
Note
For Universal Windows Platform (UWP) app on Windows 10, the default GridView template sets the Orientation to Horizontal.
When the value is Vertical, the grid adds items in columns from top to bottom, then wraps from left to right. Columns of items scroll or pan horizontally.
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. Rows of items scroll or pan vertically.
Item 1 | Item 2 | Item 3 |
Item 4 | Item 5 | Item 6 |
Item 7 | Item 8 | Item 9 |
<GridView>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>