IsItemsHost Property

Panel.IsItemsHost Property


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

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

public bool IsItemsHost { get; set; }

Property Value

Type: System.Boolean

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

You cannot bind data to this property.

Identifier field


Metadata properties set to true


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.

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

.NET Framework
Available since 3.0
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Return to top
© 2015 Microsoft