When I set the HeaderTemplate property of an AdvancedTabItem Visibility is set to Collapsed

Docking/MDI for WPF Forum

Posted 7 years ago by Magnum White
Version: 16.1.0636
Platform: .NET 4.5
Environment: Windows 10 (64-bit)

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?


        <Style TargetType="{x:Type docking:AdvancedTabItem}" x:Key="MyTabStyle">
            <Setter Property="Background" Value="Orange"/>
            <Setter Property="HeaderTemplate">
                    <DataTemplate >
                        <!--<StackPanel Orientation="Horizontal" Margin="5" Width="30" Height="20">-->
                            <TextBlock Text="{Binding Name}"  FontSize="22" Background="HotPink" />

        <docking:AdvancedTabControl MinHeight="80" 
                                    ItemContainerStyle="{StaticResource MyTabStyle}" 
                                    ItemsSource="{Binding Groups}" 
                                    SelectedItem="{Binding SelectedGroup}" />


[Modified 7 years ago]

Comments (1)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Tony,

I tried your sample with StackPanel and didn't see any issues.  I wouldn't recommend necessarily setting such a small Width/Height on your StackPanel though since you are blocking a lot of the content from showing in this case.  If you remove the Width/Height there, I see tabs showing fine.  We don't have anything in our code that singles out StackPanel controls or any other controls in the HeaderTemplate.

We do have an implicit Style in the ContentPresenter targeting TextBlock that sets TextTrimming="CharacterEllipses" and TextWrapping="NoWrap".  Perhaps that with the size restrictions was contributing here for you?

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.