Resize TabItem header size inside TabControl

berry wer picture berry wer · Aug 2, 2015 · Viewed 9.1k times · Source

I am using MahApps TabControl and i have several TabItems:

<TabControl Name="tabControl" FontSize="12">
    <TabItem Header="Statistics" />
</TabControl>

I try to change the font size of the TabControl and TabItems in order to resize my headers but it seems that this not changing anything.

Answer

punker76 picture punker76 · Aug 5, 2015

You should use the attached property HeaderFontSize to set the header font size of the tav items.

<TabControl Name="tabControl">
  <TabItem Header="Statistics" Controls:ControlsHelper.HeaderFontSize="12" />
</TabControl>

or

<TabControl Name="tabControl">
  <TabControl.Resources>
    <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}">
      <Setter Property="Controls:ControlsHelper.HeaderFontSize" Value="12" />
    </Style>
  </TabControl.Resources>
  <TabItem Header="Statistics" />
</TabControl>

Hope that helps.