I am working with WPF and MVVM. I installed Mahapps Metro, this nuget package provides all styles for my app.
I made a TabControl, but the FontSize that Mahapps uses for the header in each TabItem is very big for my application.
I need to create a StaticResource that changes the FontSize of the header in a TabItem without removing others properties that Mahapps provides.
Put the following code in your window's resources like:
<Window
......
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
......
>
<Window.Resources>
<Style x:Key="MenuLevel2" BasedOn="{StaticResource MetroTabItem}" TargetType="{x:Type TabItem}">
<Setter Property="mah:ControlsHelper.HeaderFontSize" Value="24"></Setter>
</Style>
<Window.Resources>
Looking at the source code [ https://github.com/MahApps/MahApps.Metro/blob/master/MahApps.Metro/Styles/Controls.TabControl.xaml ,at line 158] you can see that the programmers made a special exception to set this property, because the font is in a Control Template, inside a Content Presenter. It is easier to set ControlsHelper.HeaderFontSize property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With