Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Panel.IsItemsHost Property

Updated: February 2009

Gets or sets a value that indicates that this Panel is a container for user interface (UI) items that are generated by an ItemsControl. This is a dependency property. 

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public bool IsItemsHost { get; set; }
<object IsItemsHost="bool" .../>

Property Value

Type: System.Boolean
true if this instance of Panel is an items host; otherwise, false. The default value is false.

Identifier field


Metadata properties set to true


You cannot bind data to this property.

The following example uses a ControlTemplate to create a horizontal ListBox. The horizontal StackPanel is specified within the ControlTemplate. The IsItemsHost property is set to true on the StackPanel, which indicates that the generated items should be placed in the panel. When you specify it this way, the ItemsPanel cannot be replaced by the user of the control without using a ControlTemplate. Therefore, do this only if you know that you do not want the panel to be replaced without the use of a template.

<Style TargetType="ListBox">
  <Setter Property="Template">
      <ControlTemplate TargetType="ListBox">
        <Border CornerRadius="5" Background="{TemplateBinding ListBox.Background}">
          <ScrollViewer HorizontalScrollBarVisibility="Auto">
            <StackPanel Orientation="Horizontal"

Alternatively, you can set the ItemsControl.ItemsPanel property. The following example sets the ItemsPanel in a Style of a ListBox.

  <Style TargetType="Separator">
    <Setter Property="Template">
        <ControlTemplate TargetType="{x:Type Separator}">
          <Border Width="2" Height="12" Margin="4" Background="Gray"/>

  <Style TargetType="ListBox">
    <Setter Property="ItemsPanel">
          <StackPanel Orientation="Horizontal"


Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0




February 2009

Added an example that uses the IsItemsHost property..

Customer feedback.

© 2018 Microsoft