Initially in my DataTemplate, I had a StackPanel with a TextBlock within it and everytime I started up my application what I expected to be displyed would be set to Visibility Collapsed on the StackPanel.
With the same code working on a normal TabItem as I was expecting them to work in a fairly similar way.
After some head scratching I found a helpful topic on the forum where an example of a HeaderTemplate being set.
It turns out it is okay if I use a Grid, or not Panels at all...
Is there a specific way why your implementation doesn't work with StackPanels? And possibly why this should be avoided with normal TabItems?
<UserControl>
<UserControl.Resources>
<Style TargetType="{x:Type docking:AdvancedTabItem}" x:Key="MyTabStyle">
<Setter Property="Background" Value="Orange"/>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate >
<!--<StackPanel Orientation="Horizontal" Margin="5" Width="30" Height="20">-->
<Grid>
<TextBlock Text="{Binding Name}" FontSize="22" Background="HotPink" />
</Grid>
<!--</StackPanel>-->
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<docking:AdvancedTabControl MinHeight="80"
CanTabsDrag="True"
ItemContainerStyle="{StaticResource MyTabStyle}"
ItemsSource="{Binding Groups}"
SelectedItem="{Binding SelectedGroup}" />
</Grid>
</UserControl>
[Modified 8 years ago]