-api-id | -api-type |
---|---|
P:Microsoft.UI.Xaml.Controls.ItemsControl.ItemsPanel |
winrt property |
Gets or sets the template that defines the panel that controls the layout of items.
<itemsControl>
<itemsControl.ItemsPanel>
singlePanelTemplate
</itemsControl.ItemsPanel>
</itemsControl>
- or -
<itemsControl ItemsPanel="resourceReferenceToPanelTemplate"/>
- 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.
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.
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>