0

I have set a style in App.xaml

<Style TargetType="TextBlock">
        <Setter Property="Margin" Value="3"/>
</Style>

I realized that this also increased the headers in my TabControl which was not my intention.

I tried to restore hight in TabControl Header without success. (And tried the same with TabItem also)

        <TabControl.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="Margin" Value="0"/>
            </Style>    
        </TabControl.Resources>

Update 1: one suggestion was to define an empty style for TextBlocks in TabControl. It did not help.

    <Style TargetType="TabControl">
        <Style.Resources>
            <Style TargetType="TextBlock" />
        </Style.Resources>
    </Style>
Istvan Heckl
  • 864
  • 10
  • 22
  • Possible duplicate of [Ignore global style for specific control and it's children](https://stackoverflow.com/questions/37491430/ignore-global-style-for-specific-control-and-its-children) – Sinatr Jun 14 '19 at 07:53
  • Do not define an implicit `TextBlock` style in `App.xaml` because you won't be able to override it using another implicit style. – mm8 Jun 14 '19 at 12:00

3 Answers3

0

try FontSize like this:

   <TabControl.Style>
   <Style TargetType="{x:Type TabControl}">
   <Setter Property="FontSize" Value="27"/>
   </Style>
   </TabControl.Style>
Maria
  • 344
  • 8
  • 30
0

By increasing the margin (Margin="15,20") top(example : 20) you can increase the height of tab control menu header,

<TabControl.Resources>
                    <Style TargetType="TabItem">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="TabItem">
                                    <Grid Name="Panel">
                                        <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Header" Margin="15,20" />
                                    </Grid>
                               </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>                      
 </TabControl.Resources>
Hareesh
  • 1
  • 3
0

Thanks @mm8. I removed the style from App.xaml and put it into Window.Resources. Now the TabControl header is not effected.

Istvan Heckl
  • 864
  • 10
  • 22