# Customizing Tab Items

This article shows how to customize the appearance of the RadTabControl's tab items.

## Tab Orientation

The orientation of the tab items can be switched using the **TabOrientation** property of RadTabControl. The supported orientations are **Horizontal** and **Vertical**. The tabs are oriented horizontally by default.

**Example 1: Setting tab orientation**

```XAML
<telerik:RadTabControl TabOrientation="Vertical">
    <telerik:RadTabItem Header="Home" Content="Home content" />
    <telerik:RadTabItem Header="View" Content="View content"/>
    <telerik:RadTabItem Header="Insert" Content="Insert content"/>
    <telerik:RadTabItem Header="Settings" Content="Settings content" />
</telerik:RadTabControl>
```

![WPF RadTabControl Tab Orientation Vertical](https://www.telerik.com/products/wpf/documentation/assets/0142617a2bfe84621821d37f81e485bb/radtabcontrol-appearance-customizing-tab-items-0.png)

## Items Size

The size and spacing of the RadTabItem elements can be modified using the **Width**, **Height**, **Margin** and **Padding** properties inherited from the FrameworkElement base class.

**Example 2: Setting sizing and spacing of tab items**

```XAML
<telerik:RadTabControl>
    <telerik:RadTabItem Header="Home" Content="Home content" Margin="10 0 0 0" Width="150" Height="100"/>
    <telerik:RadTabItem Header="View" Content="View content" Margin="10 0 0 0"/>
    <telerik:RadTabItem Header="Insert" Content="Insert content" Margin="10 0 0 0"/>
    <telerik:RadTabItem Header="Settings" Content="Settings content" Margin="10 0 0 0"/>
</telerik:RadTabControl>
```

> The Height setting of the RadTabItem will stretch the entire tabstrip area.

![WPF RadTabControl Custom Tab Strip Height](https://www.telerik.com/products/wpf/documentation/assets/238f81bd17b72986853246f39ba118ae/radtabcontrol-appearance-customizing-tab-items-1.png)

## Item Container Style

The RadTabItem elements can be customized using a single Style object. The Style is applied using the **ItemContainerStyle** property of RadTabControl.

**Example 3: Setting ItemContainerStyle**

```XAML
<telerik:RadTabControl>
    <telerik:RadTabControl.ItemContainerStyle>
        <Style TargetType="telerik:RadTabItem">
            <Setter Property="Width" Value="100" />
            <Setter Property="Height" Value="60" />
            <Setter Property="CloseButtonVisibility" Value="Visible" />
        </Style>
    </telerik:RadTabControl.ItemContainerStyle>
    <telerik:RadTabItem Header="Home" Content="Home content" />
    <telerik:RadTabItem Header="View" Content="View content"/>
    <telerik:RadTabItem Header="Insert" Content="Insert content"/>
    <telerik:RadTabItem Header="Settings" Content="Settings content"/>
</telerik:RadTabControl>
```

![WPF RadTabControl Tab Items with Close Button](https://www.telerik.com/products/wpf/documentation/assets/21eedbbd2b48b0707217aa1eff5169bf/radtabcontrol-appearance-customizing-tab-items-2.png)

The control also provides style selector support via the **ItemContainerStyleSelector** property of RadTabControl. Read how to implement a `StyleSelector` in the corresponding [MSDN article](https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.styleselector?view=netframework-4.5).

## Item Template

The template of the RadTabItems can be customized using the **ItemTemplate** property of RadTabControl. The property is useful in case the ItemsSource of the control is used (data binding scenario).

The following example shows how to setup a basic model, populate RadTabControl with data and customize the template of the tabs.

**Example 4: Defining tab model**

```C#
public class TabInfo
{
    public string Header { get; set; }
    public string Content { get; set; }
}
```

**Example 5: Populating the control with data**

```C#
public void SetDataContext()
{
    this.DataContext = new ObservableCollection<TabInfo>()
    {
       new TabInfo() { Header = "Home", Content="Home content" },
       new TabInfo() { Header = "Insert", Content="Insert content" },
       new TabInfo() { Header = "Settings", Content="Settings content" }
    };
}
```

**Example 6: Setting up the ItemTemplate**

```XAML
<telerik:RadTabControl ItemsSource="{Binding}">
    <telerik:RadTabControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Header}" FontWeight="Bold" FontStyle="Italic" Foreground="#0099BC"/>
        </DataTemplate>
    </telerik:RadTabControl.ItemTemplate>
    <telerik:RadTabControl.ContentTemplate>
        <DataTemplate>
            <Border>
                <TextBlock Text="{Binding Content}" VerticalAlignment="Center" TextAlignment="Center"/>
            </Border>
        </DataTemplate>
    </telerik:RadTabControl.ContentTemplate>
</telerik:RadTabControl>
```

![WPF RadTabControl Custom Italic Item Template](https://www.telerik.com/products/wpf/documentation/assets/d375439dfe51db6747c23bf15ec9e846/radtabcontrol-appearance-customizing-tab-items-3.png)

The ItemTemplate is inherited by the **HeaderTemplate** property of each RadTabItem. The HeaderTemplate property can be used as an alternative of the ItemTemplate.

**Example 7: Setting HeaderTemplate**

```XAML
<Grid>
    <Grid.Resources>
        <DataTemplate x:Key="TabHeaderTemplate">
            <TextBlock Text="{Binding}" FontWeight="Bold" FontStyle="Italic" Foreground="#0099BC"/>
        </DataTemplate>
    </Grid.Resources>
    <telerik:RadTabControl>
        <telerik:RadTabItem Header="Home" Content="Home content" HeaderTemplate="{StaticResource TabHeaderTemplate}" />
        <telerik:RadTabItem Header="View" Content="View content"/>
        <telerik:RadTabItem Header="Insert" Content="Insert content"/>
        <telerik:RadTabItem Header="Settings" Content="Settings content"/>
    </telerik:RadTabControl>
</Grid>
```

The ItemTemplate and HeaderTemplate have corresponding DataTemplateSelector alternatives - the **ItemTemplateSelector** and **HeaderTemplateSelector** properties - that allow you to choose the DataTemplate based on a custom condition. Read how to implement a `DataTemplateSelector` in the corresponding [MSDN article](https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.datatemplateselector?view=netframework-4.5).

> tip The template of the selected tab content can be customized using the [ContentTemplate](https://www.telerik.com/products/wpf/documentation/controls/radtabcontrol/appearance/customizing-selected-tab-content) property of RadTabControl.

## Tabstrip Background

To change the background of the area behind the tab items (the [tabstrip](https://www.telerik.com/products/wpf/documentation/controls/radtabcontrol/general-information/visual-structure)), set the **HeaderBackground** property of RadTabControl.

**Example 8: Setting HeaderBackground**

```XAML
<telerik:RadTabControl HeaderBackground="#F6DC9D" />
```

![WPF RadTabControl TabStrip Background](https://www.telerik.com/products/wpf/documentation/assets/a38fdea9b7b1ac57d6717f7e9f99e117/radtabcontrol-appearance-customizing-tab-items-4.png)
