如何在不更改内容字体的情况下更改 TabItem 的标题字体? [英] How to change TabItem's Header font without changing content's font?
本文介绍了如何在不更改内容字体的情况下更改 TabItem 的标题字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在不更改内容字体的情况下更改 TabItem 标题中的字体?当我在 TabItem
中设置 FontSize
属性时,它也会改变 TextBlock
s 上的 FontSize.
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 TextBlock
s.
<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>
推荐答案
你可以这样做 -
<TabControl>
<TabItem>
<TabItem.Header>
<TextBlock Text="Tab1" FontSize="23" />
</TabItem.Header>
<TextBlock Text="Content" />
</TabItem>
</TabControl>
这篇关于如何在不更改内容字体的情况下更改 TabItem 的标题字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文