HeaderedItemsControl.Header Property
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Gets or sets the item that labels the control.
Namespace: System.Windows.Controls
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
<object> <object.Header> <UIElement /> </object.Header> </object>
<object Header="headerString"/>
XAML Values
Property Value
Type: System.ObjectAn object that labels the HeaderedItemsControl. The default is null. A header can be a string or a UIElement.
Because the Header property is of type Object, there are no restrictions on what you can put in the Header. The Header is displayed by a ContentPresenter, which is in the HeaderTemplate of the HeaderedItemsControl. For more information about how the ContentPresenter displays the Header, see ContentPresenter.
The following example shows how to create and use a header template to specify the appearance of the header.
<!--Define a control template for a HeaderedItemsControl--> <Style TargetType="HeaderedItemsControl"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type HeaderedItemsControl}"> <StackPanel> <Grid> <Rectangle Fill="{TemplateBinding Background}"/> <ContentPresenter ContentSource="Header"/> </Grid> <Grid> <Rectangle Stroke="{TemplateBinding BorderBrush}"/> <ItemsPresenter Margin="2,0,0,0"/> </Grid> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> ... <DataTemplate x:Key="RedHeaderTemplate"> <TextBlock Text="{Binding}" Foreground="Red" FontSize="16" FontWeight="Bold" TextWrapping="Wrap"/> </DataTemplate> <DataTemplate x:Key="GreenItemTemplate"> <TextBlock Text="{Binding}" Foreground="Green" FontSize="14" FontWeight="Bold"></TextBlock> </DataTemplate> ... <!--Crate a HeaderedItemControl with a red header and green items.--> <HeaderedItemsControl Name="hitemsCtrl" Background="DarkBlue" BorderBrush="Black" Header="Header" HeaderTemplate="{StaticResource RedHeaderTemplate}" ItemsSource="{Binding Source={StaticResource Numbers}}" ItemTemplate = "{StaticResource GreenItemTemplate}" />
Windows 8 Consumer Preview, Windows Server 8 Beta, Windows 7, Windows Server 2008 SP2, Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.