Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

HeaderedItemsControl Class

Represents a control that contains multiple items and have a header.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[LocalizabilityAttribute(LocalizationCategory.Menu)] 
public class HeaderedItemsControl : ItemsControl
/** @attribute LocalizabilityAttribute(LocalizationCategory.Menu) */ 
public class HeaderedItemsControl extends ItemsControl
LocalizabilityAttribute(LocalizationCategory.Menu) 
public class HeaderedItemsControl extends ItemsControl
<HeaderedItemsControl>
  Items
</HeaderedItemsControl>

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 control template.

Set the Header property to specify the label of the HeaderedItemsControl. Header can be a string or a UIElement. 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 HeaderedItemsControl Content Model.

The following example creates 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.Object
   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
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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. All rights reserved.