HeaderedItemsControl Class
Updated: February 2009
Represents a control that contains multiple items and has a header.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Use this class to create a control that contains a heading (or title) and multiple items. A HeaderedItemsControl has a limited default style. To create a HeaderedItemsControl with a custom appearance, you can create a new ControlTemplate.
Set the Header property to specify the label of the HeaderedItemsControl. Header can be any type of object. Set the HeaderTemplate property to a DataTemplate to customize the header. For more information on data templates, see Data Templating Overview.
Content Model: For information on the content model for HeaderedItemsControl, see Controls Content Model Overview.
Dependency properties for this control might be set by the control’s default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. For more information, see Themes.
The following example creates a ControlTemplate for a HeaderedItemsControl.
<!--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> ... <HeaderedItemsControl xmlns:sys="clr-namespace:System;assembly=mscorlib" Header="My colors" Background="SteelBlue" BorderBrush="DarkSlateBlue"> <sys:String>Red</sys:String> <sys:String>Yellow</sys:String> <sys:String>Blue</sys:String> <sys:String>Green</sys:String> </HeaderedItemsControl>
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Media.Visual
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Control
System.Windows.Controls.ItemsControl
System.Windows.Controls.HeaderedItemsControl
System.Windows.Controls.MenuItem
System.Windows.Controls.ToolBar
System.Windows.Controls.TreeViewItem
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.
Date | History | Reason |
|---|---|---|
February 2009 | Described how default styles change dependency properties. | Customer feedback. |
July 2008 | Added new members: HeaderStringFormat property, OnHeaderStringFormatChanged method, HeaderStringFormatProperty field. | SP1 feature change. |