Click here to Skip to main content
15,072,422 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi forum,

there's a TabControl in a WPF software I have to make touch-friendly. I would like to increase the height of all the headers to 48 pixels so they fit nicely with the buttons that alre already large enough for fingers to push them.

But there seems to be no <header.height> property to change.

I have seen several articles on hiding the header altogether or ones that completely redesign the header in arbitrary ways.

Is there a way to only change the Height or MinimumHeight or so for a TabControl header?

What I have tried:

    <ControlTemplate x:Key="TouchTabControl" TargetType="TabControl">
        <ContentPresenter Heading.Height="48" />
Error: Heading.Height is not supported by a Windows Presentation Foundation (WPF)-Project.

    <Style TargetType="TabControl">
        <Setter Property="HeaderTemplate">
                        <TextBlock FontSize="48" Text="{TemplateBinding Content}" />

Error1: "HeaderTemplate" has not been recognized or is not accessible.
Error2: "Content" has not been recognized or is not accessible.
Updated 20-Oct-20 1:02am

Just change the Height of one Header:
            <Grid Height="48">
               <TextBlock Text="Press me"
                          VerticalAlignment="Center" />
      <TabItem Header="Me Too" />
lukeer 20-Oct-20 4:02am
Thank you.
That looks as if I would essentially create a custom header of the size I want it to have.

Is it possible to not do that for a particular TabControl but in a way that it can be applied to several (or all) TabControls in a Window?
Starting here[^], I came up with this:
<Style TargetType="{x:Type TabItem}">
    <Setter Property="HeaderTemplate">
                <ContentPresenter Content="{TemplateBinding Content}" Height="48" />
    <Setter Property="Padding" Value="3" />
Thank you everyone for brooding over this with me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900