Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 2.74 KB

itemswrapgrid.md

File metadata and controls

63 lines (43 loc) · 2.74 KB
-api-id -api-type
T:Windows.UI.Xaml.Controls.ItemsWrapGrid
winrt class

Windows.UI.Xaml.Controls.ItemsWrapGrid

-description

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.

-xaml-syntax

<ItemsWrapGrid .../>

-remarks

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.

Orientation

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 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. Rows of items scroll or pan vertically.

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

-examples

<GridView>
    <GridView.ItemsPanel> 
        <ItemsPanelTemplate>
            <ItemsWrapGrid Orientation="Horizontal"/>  
        </ItemsPanelTemplate> 
    </GridView.ItemsPanel> 
</GridView> 

-see-also

Panel, Orientation enumeration