开发者

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

开发者 https://www.devze.com 2023-02-28 15:00 出处:网络
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.

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>


You can do like this -

        <TabControl>
            <TabItem>
                <TabItem.Header>
                    <TextBlock Text="Tab1" FontSize="23" />
                </TabItem.Header>
                <TextBlock Text="Content" />
            </TabItem>
        </TabControl>
0

精彩评论

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