Export (0) Print
Expand All

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)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[BindableAttribute(false)] 
public bool IsItemsHost { get; set; }
/** @property */
public boolean get_IsItemsHost ()

/** @property */
public void set_IsItemsHost (boolean value)

public function get IsItemsHost () : boolean

public function set IsItemsHost (value : boolean)

<object IsItemsHost="bool" .../>

Property Value

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

Identifier field

IsItemsHostProperty

Metadata properties set to true

IsNotDataBindable

You cannot databind to this property.

The following example demonstrates how to use the derived StackPanel element as an item's host.

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

  <Style x:Key="ListBoxTemplate" TargetType="{x:Type ListBox}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListBox}">
          <Border Background="{TemplateBinding Panel.Background}" 
                  BorderBrush="{TemplateBinding Border.BorderBrush}"
                  BorderThickness="{TemplateBinding Border.BorderThickness}">
            <ScrollViewer HorizontalScrollBarVisibility="Auto">
              <StackPanel x:Name="StackPanel1" IsItemsHost="True"
                 Orientation="Horizontal"/>
            </ScrollViewer>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</Grid.Resources>

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft