ItemsWrapGrid ItemsWrapGrid ItemsWrapGrid 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.

Syntax

Declaration

public sealed class ItemsWrapGridpublic sealed class ItemsWrapGridPublic NotInheritable Class ItemsWrapGrid
<ItemsWrapGrid .../>

Inheritance Hierarchy

Inherited Members

Inherited properties

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Tag
Tag
Tag
, , , , , , , , , , , , , , , , , , , , , , , , ,

Inherited events

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Inherited methods

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

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.

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> 

Constructors summary

Initializes a new instance of the ItemsWrapGrid class.

Properties summary

Gets or sets a value that specifies whether a group header moves with the group when the group is panned vertically.

Identifies the AreStickyGroupHeadersEnabled dependency property.

Gets or sets the size of the buffers for items outside the viewport, in multiples of the viewport size.

Identifies the CacheLength dependency property.

Gets the index in the data collection of the first item in the cache.

Gets the index in the data collection of the first item on the screen. Partially visible items are considered to be on screen.

Gets or sets a value that specifies where group headers are positioned in relation to the group.

Identifies the GroupHeaderPlacement dependency property.

Gets or sets the amount of space around a group.

Identifies the GroupPadding dependency property.

Gets or sets the height of the layout area for each item that is contained in an ItemsWrapGrid.

Identifies the ItemHeight dependency property.

Gets or sets the width of the layout area for each item that is contained in an ItemsWrapGrid.

Identifies the ItemWidth dependency property.

Gets the index in the data collection of the last item in the cache.

Gets the index in the data collection of the last item on the screen. Partially visible items are considered to be on screen.

Gets or sets a value that influences the wrap point, also accounting for Orientation.

Identifies the MaximumRowsOrColumns dependency property.

Gets or sets the dimension by which child elements are stacked.

Identifies the Orientation dependency property.

Gets a value that indicates whether items are panning forward or backward, or aren't panning.

Constructors

  • ItemsWrapGrid()
    ItemsWrapGrid()
    ItemsWrapGrid()
    ItemsWrapGrid()

    Initializes a new instance of the ItemsWrapGrid class.

    public ItemsWrapGrid()public New()Public Sub New()public ItemsWrapGrid()

Properties

  • AreStickyGroupHeadersEnabled
    AreStickyGroupHeadersEnabled
    AreStickyGroupHeadersEnabled
    AreStickyGroupHeadersEnabled

    Gets or sets a value that specifies whether a group header moves with the group when the group is panned vertically.

    public bool AreStickyGroupHeadersEnabled { get; set; }public bool AreStickyGroupHeadersEnabled { get; set; }Public ReadWrite Property AreStickyGroupHeadersEnabled As boolpublic bool AreStickyGroupHeadersEnabled { get; set; }

    Property Value

    • bool
      bool
      bool

      true if the group header moves with the group when the group is panned vertically; otherwise, false. The default is true.

    Remarks

    Group headers can be sticky only when the group is panned vertically and the GroupHeaderPlacement is Top. If the panel's Orientation is Horizontal or GroupHeaderPlacement is not Top, this property is ignored.

    Examples

    <GridView>
        <GridView.ItemsPanel> 
            <ItemsPanelTemplate>
                <ItemsWrapGrid AreStickyGroupHeadersEnabled="False" Orientation="Horizontal"/>  
            </ItemsPanelTemplate> 
        </GridView.ItemsPanel> 
    </GridView> 
    
  • AreStickyGroupHeadersEnabledProperty
    AreStickyGroupHeadersEnabledProperty
    AreStickyGroupHeadersEnabledProperty
    AreStickyGroupHeadersEnabledProperty

    Identifies the AreStickyGroupHeadersEnabled dependency property.

    public static DependencyProperty AreStickyGroupHeadersEnabledProperty { get; }public static DependencyProperty AreStickyGroupHeadersEnabledProperty { get; }Public Static ReadOnly Property AreStickyGroupHeadersEnabledProperty As DependencyPropertypublic static DependencyProperty AreStickyGroupHeadersEnabledProperty { get; }

    Property Value

  • CacheLength
    CacheLength
    CacheLength
    CacheLength

    Gets or sets the size of the buffers for items outside the viewport, in multiples of the viewport size.

    public double CacheLength { get; set; }public double CacheLength { get; set; }Public ReadWrite Property CacheLength As doublepublic double CacheLength { get; set; }
    ItemsWrapGrid CacheLength="double" />
    

    Property Value

    • double
      double
      double

      The size of the buffers for items outside the viewport, in multiples of the viewport size. The default is 4.0.

    Remarks

    To improve scrolling performance, ItemsWrapGrid creates and caches item containers for items that are off-screen on both sides of the viewport. The CacheLength property specifies the size of the buffers for the off-screen items. You specify CacheLength in multiples of the current viewport size. For example, if the CacheLength is 4.0, 2 viewports worth of items are buffered on each side of the viewport.

    You can set a smaller cache length to optimize startup time, or set a larger cache size to optimize scrolling performance. Item containers that are off-screen are created at a lower priority than those in the viewport.

  • CacheLengthProperty
    CacheLengthProperty
    CacheLengthProperty
    CacheLengthProperty

    Identifies the CacheLength dependency property.

    public static DependencyProperty CacheLengthProperty { get; }public static DependencyProperty CacheLengthProperty { get; }Public Static ReadOnly Property CacheLengthProperty As DependencyPropertypublic static DependencyProperty CacheLengthProperty { get; }

    Property Value

  • FirstCacheIndex
    FirstCacheIndex
    FirstCacheIndex
    FirstCacheIndex

    Gets the index in the data collection of the first item in the cache.

    public int FirstCacheIndex { get; }public int FirstCacheIndex { get; }Public ReadOnly Property FirstCacheIndex As intpublic int FirstCacheIndex { get; }

    Property Value

    • int
      int
      int

      The index in the data collection of the first item in the cache. The default is -1.

    Remarks

    The index of the container for the very first item and the focused items are not reported if they are not in the cache.

  • FirstVisibleIndex
    FirstVisibleIndex
    FirstVisibleIndex
    FirstVisibleIndex

    Gets the index in the data collection of the first item on the screen. Partially visible items are considered to be on screen.

    public int FirstVisibleIndex { get; }public int FirstVisibleIndex { get; }Public ReadOnly Property FirstVisibleIndex As intpublic int FirstVisibleIndex { get; }

    Property Value

    • int
      int
      int

      The index in the data collection of the first item on the screen. The default is -1.

  • GroupHeaderPlacement
    GroupHeaderPlacement
    GroupHeaderPlacement
    GroupHeaderPlacement

    Gets or sets a value that specifies where group headers are positioned in relation to the group.

    public GroupHeaderPlacement GroupHeaderPlacement { get; set; }public GroupHeaderPlacement GroupHeaderPlacement { get; set; }Public ReadWrite Property GroupHeaderPlacement As GroupHeaderPlacementpublic GroupHeaderPlacement GroupHeaderPlacement { get; set; }
    ItemsWrapGrid GroupHeaderPlacement="groupHeaderPlacementMemberName" />
    

    Property Value

    Remarks

    Valid values are Top and Left.

  • GroupHeaderPlacementProperty
    GroupHeaderPlacementProperty
    GroupHeaderPlacementProperty
    GroupHeaderPlacementProperty

    Identifies the GroupHeaderPlacement dependency property.

    public static DependencyProperty GroupHeaderPlacementProperty { get; }public static DependencyProperty GroupHeaderPlacementProperty { get; }Public Static ReadOnly Property GroupHeaderPlacementProperty As DependencyPropertypublic static DependencyProperty GroupHeaderPlacementProperty { get; }

    Property Value

  • GroupPadding
    GroupPadding
    GroupPadding
    GroupPadding

    Gets or sets the amount of space around a group.

    public Thickness GroupPadding { get; set; }public Thickness GroupPadding { get; set; }Public ReadWrite Property GroupPadding As Thicknesspublic Thickness GroupPadding { get; set; }

    Property Value

  • GroupPaddingProperty
    GroupPaddingProperty
    GroupPaddingProperty
    GroupPaddingProperty

    Identifies the GroupPadding dependency property.

    public static DependencyProperty GroupPaddingProperty { get; }public static DependencyProperty GroupPaddingProperty { get; }Public Static ReadOnly Property GroupPaddingProperty As DependencyPropertypublic static DependencyProperty GroupPaddingProperty { get; }

    Property Value

  • ItemHeight
    ItemHeight
    ItemHeight
    ItemHeight

    Gets or sets the height of the layout area for each item that is contained in an ItemsWrapGrid.

    public double ItemHeight { get; set; }public double ItemHeight { get; set; }Public ReadWrite Property ItemHeight As doublepublic double ItemHeight { get; set; }
    <ItemsWrapGrid ItemHeight="double" />
    

    Property Value

    • double
      double
      double

      The height of the layout area for each item that is contained in an ItemsWrapGrid. The default is Double.NaN, which results in the "Auto" layout behavior.

    Remarks

    "Auto" layout and Double.NaN

    The default value of ItemHeight and ItemWidth is not 0, it is Double.NaN. ItemHeight and ItemWidth support the ability to be an unset "Auto" value. Because ItemHeight and ItemWidth are Double values, Double.NaN is used as a special value to represent this "Auto" behavior. The layout system interprets the "Auto" value to generally mean that the object should be sized to the available size in layout, instead of to a specific pixel value. If you want the "Auto" behavior for an object when it is used in layout, leave ItemHeight and ItemWidth unset at their Double.NaN default value. If you have previously set values and want to reenable the "Auto" behavior with run-time code, set to Double.NaN. In XAML such as templates, you can set attribute values using the string "Auto".

    Note

    Visual C++ component extensions (C++/CX) doesn't have a constant for NaN, it uses a value, which appears as "-1.#IND" followed by zeros.

  • ItemHeightProperty
    ItemHeightProperty
    ItemHeightProperty
    ItemHeightProperty

    Identifies the ItemHeight dependency property.

    public static DependencyProperty ItemHeightProperty { get; }public static DependencyProperty ItemHeightProperty { get; }Public Static ReadOnly Property ItemHeightProperty As DependencyPropertypublic static DependencyProperty ItemHeightProperty { get; }

    Property Value

  • ItemWidth
    ItemWidth
    ItemWidth
    ItemWidth

    Gets or sets the width of the layout area for each item that is contained in an ItemsWrapGrid.

    public double ItemWidth { get; set; }public double ItemWidth { get; set; }Public ReadWrite Property ItemWidth As doublepublic double ItemWidth { get; set; }
    <ItemsWrapGrid ItemWidth="double" />
    

    Property Value

    • double
      double
      double

      The width of the layout area for each item that is contained in an ItemsWrapGrid. The default is Double.NaN, which results in the "Auto" layout behavior.

    Remarks

    "Auto" layout and Double.NaN

    The default value of ItemHeight and ItemWidth is not 0, it is Double.NaN. ItemHeight and ItemWidth support the ability to be an unset "Auto" value. Because ItemHeight and ItemWidth are Double values, Double.NaN is used as a special value to represent this "Auto" behavior. The layout system interprets the "Auto" value to generally mean that the object should be sized to the available size in layout, instead of to a specific pixel value. If you want the "Auto" behavior for an object when it is used in layout, leave ItemHeight and ItemWidth unset at their Double.NaN default value. If you have previously set values and want to reenable the "Auto" behavior with run-time code, set to Double.NaN. In XAML such as templates, you can set attribute values using the string "Auto".

    Note

    Visual C++ component extensions (C++/CX) doesn't have a constant for NaN, it uses a value, which appears as "-1.#IND" followed by zeros.

  • ItemWidthProperty
    ItemWidthProperty
    ItemWidthProperty
    ItemWidthProperty

    Identifies the ItemWidth dependency property.

    public static DependencyProperty ItemWidthProperty { get; }public static DependencyProperty ItemWidthProperty { get; }Public Static ReadOnly Property ItemWidthProperty As DependencyPropertypublic static DependencyProperty ItemWidthProperty { get; }

    Property Value

  • LastCacheIndex
    LastCacheIndex
    LastCacheIndex
    LastCacheIndex

    Gets the index in the data collection of the last item in the cache.

    public int LastCacheIndex { get; }public int LastCacheIndex { get; }Public ReadOnly Property LastCacheIndex As intpublic int LastCacheIndex { get; }

    Property Value

    • int
      int
      int

      The index in the data collection of the last item in the cache. The default is -1.

  • LastVisibleIndex
    LastVisibleIndex
    LastVisibleIndex
    LastVisibleIndex

    Gets the index in the data collection of the last item on the screen. Partially visible items are considered to be on screen.

    public int LastVisibleIndex { get; }public int LastVisibleIndex { get; }Public ReadOnly Property LastVisibleIndex As intpublic int LastVisibleIndex { get; }

    Property Value

    • int
      int
      int

      The index in the data collection of the last item on the screen. The default is -1.

  • MaximumRowsOrColumns
    MaximumRowsOrColumns
    MaximumRowsOrColumns
    MaximumRowsOrColumns

    Gets or sets a value that influences the wrap point, also accounting for Orientation.

    public int MaximumRowsOrColumns { get; set; }public int MaximumRowsOrColumns { get; set; }Public ReadWrite Property MaximumRowsOrColumns As intpublic int MaximumRowsOrColumns { get; set; }
    <ItemsWrapGrid MaximumRowsOrColumns="int" />
    

    Property Value

    • int
      int
      int

      The maximum rows or columns that this ItemsWrapGrid should present before it introduces wrapping to the layout. The default is -1, which is a special value that indicates no maximum.

  • MaximumRowsOrColumnsProperty
    MaximumRowsOrColumnsProperty
    MaximumRowsOrColumnsProperty
    MaximumRowsOrColumnsProperty

    Identifies the MaximumRowsOrColumns dependency property.

    public static DependencyProperty MaximumRowsOrColumnsProperty { get; }public static DependencyProperty MaximumRowsOrColumnsProperty { get; }Public Static ReadOnly Property MaximumRowsOrColumnsProperty As DependencyPropertypublic static DependencyProperty MaximumRowsOrColumnsProperty { get; }

    Property Value

  • Orientation
    Orientation
    Orientation
    Orientation

    Gets or sets the dimension by which child elements are stacked.

    public Orientation Orientation { get; set; }public Orientation Orientation { get; set; }Public ReadWrite Property Orientation As Orientationpublic Orientation Orientation { get; set; }
    ItemsWrapGrid Orientation="orientationMemberName" />
    

    Property Value

    Remarks

    Note

    ItemsWrapGrid is the default ItemsPanel for GridView. For Universal Windows Platform (UWP) app on Windows 10, the default GridView template sets the Orientation to Horizontal.

  • OrientationProperty
    OrientationProperty
    OrientationProperty
    OrientationProperty

    Identifies the Orientation dependency property.

    public static DependencyProperty OrientationProperty { get; }public static DependencyProperty OrientationProperty { get; }Public Static ReadOnly Property OrientationProperty As DependencyPropertypublic static DependencyProperty OrientationProperty { get; }

    Property Value

  • ScrollingDirection
    ScrollingDirection
    ScrollingDirection
    ScrollingDirection

    Gets a value that indicates whether items are panning forward or backward, or aren't panning.

    public PanelScrollingDirection ScrollingDirection { get; }public PanelScrollingDirection ScrollingDirection { get; }Public ReadOnly Property ScrollingDirection As PanelScrollingDirectionpublic PanelScrollingDirection ScrollingDirection { get; }

    Property Value

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.UI.Xaml.Controls.dll