Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 2.4 KB

File metadata and controls

59 lines (44 loc) · 2.4 KB
-api-id -api-type
P:Windows.UI.Xaml.Controls.ItemsControl.ItemsPanel
winrt property

Windows.UI.Xaml.Controls.ItemsControl.ItemsPanel

-description

Gets or sets the template that defines the panel that controls the layout of items.

-xaml-syntax

<itemsControl>
  <itemsControl.ItemsPanel>
    singlePanelTemplate
  </itemsControl.ItemsPanel>
</itemsControl>
- or -
<itemsControl ItemsPanel="resourceReferenceToPanelTemplate"/>

-xaml-values

singlePanelTemplate
singlePanelTemplateA single ItemsPanelTemplate object element. That ItemsPanelTemplate would typically have multiple child elements that define the panel layout.
resourceReferenceToPanelTemplate
resourceReferenceToPanelTemplateA resource reference to an existing ItemsPanelTemplate from a resources collection. The resource reference must specify the desired ItemsPanelTemplate by key.
## -property-value An [ItemsPanelTemplate](itemspaneltemplate.md) that defines the panel to use for the layout of the items. The default value for the [ItemsControl](itemscontrol.md) is an [ItemsPanelTemplate](itemspaneltemplate.md) that specifies a [StackPanel](stackpanel.md).

Subtypes of ItemsControl may use different default ItemsPanelTemplates. For example, ListViews by default use an ItemsStackPanel. Using a different type may cause unexpected behavior; for example using a plain StackPanel as the ListView's ItemsPanel can regress Narrator behavior during drag and drop.

-remarks

Note

ComboBox uses a CarouselPanel as its ItemsPanel. Using a different panel as the ItemsPanel of ComboBox is not supported and might result in undesired behavior.

-examples

Replace the default panel used in a ListView with an ItemsStackPanel that has its Orientation changed to Horizontal.

<ListView>
    <x:String>Hello</x:String>
    <x:String>World</x:String>

    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <ItemsStackPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
</ListView>

-see-also