ItemsControl.ItemsPanel Property

Definition

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

C#
public ItemsPanelTemplate ItemsPanel { get; set; }
XAML
<itemsControl>
  <itemsControl.ItemsPanel>
    singlePanelTemplate
  </itemsControl.ItemsPanel>
</itemsControl>
- or -
<itemsControl ItemsPanel="resourceReferenceToPanelTemplate"/>

Property Value

An ItemsPanelTemplate that defines the panel to use for the layout of the items. The default value for the ItemsControl is an ItemsPanelTemplate that specifies a StackPanel.

Examples

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

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

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

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.

Applies to

Product Versions
Windows App SDK 0.8, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6