TabControl Class
Updated: February 2009
Represents a control that contains multiple items that share the same space on the screen.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
'Declaration <StyleTypedPropertyAttribute(Property := "ItemContainerStyle", StyleTargetType := GetType(TabItem))> _ <TemplatePartAttribute(Name := "PART_SelectedContentHost", Type := GetType(ContentPresenter))> _ Public Class TabControl _ Inherits Selector 'Usage Dim instance As TabControl
<TabControl> Items </TabControl>
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.
<TabControl> <TabItem> <TabItem.Header> <StackPanel Orientation="Horizontal"> <Ellipse Width="10" Height="10" Fill="DarkGray"/> <TextBlock>Tab 1</TextBlock> </StackPanel> </TabItem.Header> <StackPanel> <TextBlock>Enter some text</TextBlock> <TextBox Name="textBox1" Width="50"/> </StackPanel> </TabItem> <TabItem Header="Tab 2"> <!--Bind TextBlock.Text to the TextBox on the first TabItem.--> <TextBlock Text="{Binding ElementName=textBox1, Path=Text}"/> </TabItem> </TabControl>
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.Primitives.Selector
System.Windows.Controls.TabControl
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.
Date | History | Reason |
|---|---|---|
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. |