Hide the TabControl header

Viewed 56030

What's the programmatic way (ie not using styles as in this question, but using code) to hide the TabControl header? I'll be glad for a snippet.

7 Answers

Simple XAML Style

<TabControl>
    <TabControl.ItemContainerStyle>
        <Style TargetType="{x:Type TabItem}">
            <Setter Property="Visibility" Value="Collapsed"/>
        </Style>
    </TabControl.ItemContainerStyle>
    ...
</TabControl>

If you use C# and set the x:Name for the TabItem, you can also manipulate the Visibility like so:

tabItemName.Visibility = Visibility.Collapsed;
Related