Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change TabItem's Header font without changing content's font?

Tags:

c#

wpf

xaml

How to change font in TabItem's header without changing content's font? When I set FontSize property in TabItem it also changing FontSize on TextBlocks.

<Window x:Class="WpfApplication4.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Height="350" Width="525">
    <TabControl>
        <TabItem Header="item1">
            <TextBlock Text="test" Margin="20" />
        </TabItem>
        <TabItem Header="item2" FontSize="20">
            <TextBlock Text="test" Margin="20" />
        </TabItem>
    </TabControl>
</Window>
like image 554
Poma Avatar asked Apr 22 '11 07:04

Poma


1 Answers

You can do like this -

        <TabControl>
            <TabItem>
                <TabItem.Header>
                    <TextBlock Text="Tab1" FontSize="23" />
                </TabItem.Header>
                <TextBlock Text="Content" />
            </TabItem>
        </TabControl>
like image 196
Rohit Vats Avatar answered Sep 28 '22 17:09

Rohit Vats