TabControl Class
Collapse the table of content
Expand the table of content

TabControl Class

Updated: February 2009

Represents a control that contains multiple items that share the same space on the screen.

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

[StyleTypedPropertyAttribute(Property = "ItemContainerStyle", StyleTargetType = typeof(TabItem))]
[TemplatePartAttribute(Name = "PART_SelectedContentHost", Type = typeof(ContentPresenter))]
public class TabControl : Selector

The TabControl is useful for minimizing screen space usage while allowing an application to expose a large amount of data. A TabControl consists of multiple TabItem objects that share the same screen space. Only one TabItem in a TabControl is visible at a time. When a user selects the tab of a TabItem, the contents of that TabItem become visible and the contents of the other TabItem objects are hidden.

Content Model: TabControl is a ItemsControl. Its content properties are Items and ItemsSource. For more information on the content model for TabControl, 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 TabControl and binds the TextBlock in the second TabItem to a TextBox in the first TabItem.

      <StackPanel Orientation="Horizontal">
        <Ellipse Width="10" Height="10" Fill="DarkGray"/>
        <TextBlock>Tab 1</TextBlock>
      <TextBlock>Enter some text</TextBlock>
      <TextBox Name="textBox1" Width="50"/>
  <TabItem Header="Tab 2">
    <!--Bind TextBlock.Text to the TextBox on the first
    <TextBlock Text="{Binding ElementName=textBox1, Path=Text}"/>


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.

July 2008

Added new members: ContentStringFormat property, SelectedContentStringFormat property, ContentStringFormatProperty field, SelectedContentStringFormatProperty field.

SP1 feature change.

Community Additions

© 2015 Microsoft