This documentation is archived and is not being maintained.

GroupBox Class

Updated: February 2009

Represents a control that creates a container that has a border and a header for user interface (UI) content.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public class GroupBox extends HeaderedContentControl

Content Model: GroupBox is a HeaderedContentControl. Its content property is Content and its header property is Header. For more information on the content model for GroupBox, see Controls Content Model Overview.

The following illustration is an example of a GroupBox that contains a TabControl and a Button that are enclosed in a StackPanel.


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.

This example shows how to create a GroupBox that has a title and a visible border that encloses its content.

The following example defines a GroupBox control that is titled My Employee Info. The control encloses a TabControl and a Button in a StackPanel. The example sets the Header property to a Label.

  <GroupBox Width="300" Height="410">
      <Label>Employee Data</Label>
    <TabControl Name="myTabControl" 
		   Margin="0, 0, 0, 10" Height="350"
      <TabItem Name="PersonalInfo">
        <TabItem.Header>_Personal Info</TabItem.Header>
          <TextBlock>Select your name</TextBlock>
          <ListBox Name="empName" SelectionChanged="updateSummary">
            <ListBoxItem IsSelected="true">Esther</ListBoxItem>
        <TabItem.Header>_Job Info</TabItem.Header>
          <TextBlock>Select a job</TextBlock>
          <ListBox Name ="job" SelectionChanged="updateSummary">
            <ListBoxItem IsSelected="true">Programmer</ListBoxItem>
          <TabItem Name="Skill">
                  Select your strongest skill
          <ListBox Name="skills" SelectionChanged="updateSummary">
              <ListBoxItem IsSelected="true">C#</ListBoxItem>
              <ListBoxItem>Visual Basic</ListBoxItem>
        <TabItem Name="Summary" >
          <TextBlock Name="emp"/>
          <TextBlock Name="ejob"/>
          <TextBlock Name="eskill"/>
      <Button Content="Show Summary" Click="goToSummaryTab"/>

You must also define an event handler on a code-behind page in order to handle the Click event that occurs when a user clicks the Show Summary button.

For the complete sample, see GroupBox Sample.

More Code

How to: Define a GroupBox Template This example shows how to create a template for a GroupBox control.
How to: Create a Control That Has an Access Key and Text Wrapping This example shows how to create a control that has an access key and supports text wrapping. The example uses a Label control to illustrate these concepts.


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

.NET Framework

Supported in: 3.5, 3.0




February 2009

Described how default styles change dependency properties.

Customer feedback.