.NET Framework Class Library
HeaderedContentControl Class

Updated: July 2008

Provides the base implementation for all controls that contain single content and have a header.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/xaml/presentation

Visual Basic (Declaration)
<LocalizabilityAttribute(LocalizationCategory.Text)> _
Public Class HeaderedContentControl _
    Inherits ContentControl
Visual Basic (Usage)
Dim instance As HeaderedContentControl
C#
[LocalizabilityAttribute(LocalizationCategory.Text)]
public class HeaderedContentControl : ContentControl
Visual C++
[LocalizabilityAttribute(LocalizationCategory::Text)]
public ref class HeaderedContentControl : public ContentControl
J#
/** @attribute LocalizabilityAttribute(LocalizationCategory.Text) */
public class HeaderedContentControl extends ContentControl
JScript
public class HeaderedContentControl extends ContentControl
XAML Object Element Usage
<HeaderedContentControl>
  Content
</HeaderedContentControl>

Content Model: The Content property and Header property of a HeaderedContentControl can be set to any type of object. For more information on the content model for HeaderedContentControl, see Controls Content Model Overview.

A HeaderedContentControl has a limited default style. An application developer can create a HeaderedContentControl, but its appearance will be very simple. If you wish to enhance the appearance of the control, you can create a new ControlTemplate. A HeaderedContentControl is useful for creating custom controls because it provides a model for single content controls with headers.

The following examples show how to create a ControlTemplate for a HeaderedContentControl.

C#
<Style TargetType="HeaderedContentControl">
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
        <StackPanel>
          <Grid>
            <Rectangle Stroke="{TemplateBinding Background}"/>
            <ContentPresenter ContentSource="Header"/>
          </Grid>
          <Grid>
            <Rectangle Fill="{TemplateBinding Background}"/>
            <ContentPresenter ContentSource="Content"/>
          </Grid>
        </StackPanel>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

C#
<HeaderedContentControl Background="LightBlue"
                        Header="Header"
                        Content="This is the content"/>

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..::.ContentControl
                System.Windows.Controls..::.HeaderedContentControl
                  System.Windows.Controls..::.Expander
                  System.Windows.Controls..::.GroupBox
                  System.Windows.Controls..::.TabItem
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 Vista

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.

.NET Framework

Supported in: 3.5, 3.0

Date

History

Reason

July 2008

Added new members: HeaderStringFormat()()() property, HeaderStringFormatProperty()()() field, OnHeaderStringFormatChanged(String, String) method.

SP1 feature change.

Page view tracker