Void
Void

Reputation: 109

How can I set different fonts for tabitem header and content of this tabitem?

How can I set different fonts for tabitem header and content of this tabitem??

Upvotes: 2

Views: 3618

Answers (1)

Wonko the Sane
Wonko the Sane

Reputation: 10823

Like anything in WPF, there are many ways. Without knowing exactly what you are trying to do, here is one "for instance" (I wouldn't suggest using this combination of fonts:) )

    <TabControl>
        <TabControl.Resources>
            <Style TargetType="{x:Type TextBlock}">
                <Setter Property="FontFamily" Value="Comic Sans MS" />
                <Setter Property="FontSize" Value="20" />
            </Style>

            <Style x:Key="headerStyle" TargetType="{x:Type TextBlock}">
                <Setter Property="Control.FontFamily" Value="Papyrus" />
                <Setter Property="Control.FontSize" Value="12" />
            </Style>
        </TabControl.Resources>
        <TabItem>
            <TabItem.Header>
                <TextBlock Text="Header" Style="{StaticResource headerStyle}" />
            </TabItem.Header>
            <TextBlock Text="Here is the content" />
        </TabItem>
    </TabControl>

Upvotes: 2

Related Questions