GroupBox Class

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)
XML Namespace:

<LocalizabilityAttribute(LocalizationCategory.None, Readability:=Readability.Unreadable)> _
Public Class GroupBox
	Inherits HeaderedContentControl
Dim instance As GroupBox

/** @attribute LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) */ 
public class GroupBox extends HeaderedContentControl
LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) 
public class GroupBox extends HeaderedContentControl

Content Model: GroupBox is a HeaderedContentControl and has two content properties: Header and Content. For information about how to set these properties, see Headered Content Control Content Model.

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


This example shows how to create a container by using the GroupBox control. The container 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 defines the title by setting the Header property to the Label string.

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