Skip to content

Instantly share code, notes, and snippets.

@julesx
Created September 24, 2013 16:08
Show Gist options
  • Save julesx/6687138 to your computer and use it in GitHub Desktop.
Save julesx/6687138 to your computer and use it in GitHub Desktop.
<Window x:Class="WpfApplication4.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.Resources>
<Style x:Key="HiddenTabItem" TargetType="{x:Type TabItem}">
<!--<Setter Property="Visibility" Value="Visible"/>-->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Border x:Name="TabHeader" BorderThickness="1,1,0,1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" Padding="{TemplateBinding Padding}">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" VerticalAlignment="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" ContentSource="Header" RecognizesAccessKey="True"/>
</Border>
<ControlTemplate.Triggers>
<Trigger SourceName="TabHeader" Property="IsMouseOver" Value="True">
<Setter Property="Visibility" Value="Hidden" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<TabControl>
<TabItem Style="{StaticResource HiddenTabItem}" Header="Woo"></TabItem>
<TabItem Style="{StaticResource HiddenTabItem}" Header="Woo2"></TabItem>
<TabItem Style="{StaticResource HiddenTabItem}" Header="Woo3"></TabItem>
</TabControl>
</Grid>
</Window>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment