开发者

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

How开发者_如何学JAVA can I set different fonts for tabitem header and content of this tabitem??


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜