--- title: "TabControl Styles and Templates" ms.date: "03/30/2017" helpviewer_keywords: - "ControlTemplate [WPF], TabControl" - "TabControl [WPF], styles and templates [WPF]" - "parts [WPF], TabControl" - "styles [WPF], TabControl" - "states [WPF], TabControl" - "templates [WPF], TabControl" ms.assetid: f6b19a30-f10e-4fa1-96ce-f17a54092ab6 --- # TabControl Styles and Templates This topic describes the styles and templates for the control. You can modify the default to give the control a unique appearance. For more information, see [Create a template for a control](/dotnet/desktop-wpf/themes/how-to-create-apply-template). ## TabControl Parts The following table lists the named parts for the control. |Part|Type|Description| |-|-|-| |PART_SelectedContentHost||The object that shows the content of the currently selected .| When you create a for a , your template might contain an within a . (The displays each item in the ; the enables scrolling within the control). If the is not the direct child of the , you must give the the name, `ItemsPresenter`. ## TabControl States The following table lists the visual states for the control. |VisualState Name|VisualStateGroup Name|Description| |----------------------|---------------------------|-----------------| |Normal|CommonStates|The default state.| |Disabled|CommonStates|The control is disabled.| |Valid|ValidationStates|The control uses the class and the attached property is `false`.| |InvalidFocused|ValidationStates|The attached property is `true` has the control has focus.| |InvalidUnfocused|ValidationStates|The attached property is `true` has the control does not have focus.| ## TabItem Parts The control does not have any named parts. ## TabItem States The following table lists the visual states for the control. |VisualState Name|VisualStateGroup Name|Description| |----------------------|---------------------------|-----------------| |Normal|CommonStates|The default state.| |MouseOver|CommonStates|The mouse pointer is positioned over the control.| |Disabled|CommonStates|The control is disabled.| |Focused|FocusStates|The control has focus.| |Unfocused|FocusStates|The control does not have focus.| |Selected|SelectionStates|The control is selected.| |Unselected|SelectionStates|The control is not selected.| |Valid|ValidationStates|The control uses the class and the attached property is `false`.| |InvalidFocused|ValidationStates|The attached property is `true` has the control has focus.| |InvalidUnfocused|ValidationStates|The attached property is `true` has the control does not have focus.| ## TabControl ControlTemplate Example The following example shows how to define a for the and controls. [!code-xaml[ControlTemplateExamples#TabControl](~/samples/snippets/csharp/VS_Snippets_Wpf/ControlTemplateExamples/CS/resources/tabcontrol.xaml#tabcontrol)] The preceding example uses one or more of the following resources. [!code-xaml[ControlTemplateExamples#Resources](~/samples/snippets/csharp/VS_Snippets_Wpf/ControlTemplateExamples/CS/resources/shared.xaml#resources)] For the complete sample, see [Styling with ControlTemplates Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Styles%20&%20Templates/IntroToStylingAndTemplating). ## See also - - - [Control Styles and Templates](control-styles-and-templates.md) - [Control Customization](control-customization.md) - [Styling and Templating](/dotnet/desktop-wpf/fundamentals/styles-templates-overview) - [Create a template for a control](/dotnet/desktop-wpf/themes/how-to-create-apply-template)