gpt4 book ai didi

xaml - 如何设置 HubSection 标题样式

转载 作者:行者123 更新时间:2023-12-02 07:51:15 24 4
gpt4 key购买 nike

我想更改 HubSection 标题的字体系列、字体大小和前景色。

类似这样的事情:

<Style TargetType="HubSection" x:Key="HubSection">
<Setter Property="Header">
<Setter.Value>
<Setter Property="FontSize" Value="100"></Setter>
<Setter Property="Foreground" Value="Yellow"></Setter>
</Setter.Value>
</Setter>
</Style>


<HubSection Width="500" Header="Section Name" Style="{StaticResource HubSection}">

我该怎么做?

最佳答案

您要更改的属性不是 Header,而是 HeaderTemplate。这是我的工作示例:

<Style TargetType="HubSection">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}"
FontSize="100"
Foreground="Yellow"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>

如果您想将此样式应用于应用中的所有 Hub 控件,只需删除 Key 并将其放入 App.xaml 资源中的文件。

关于xaml - 如何设置 HubSection 标题样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28644679/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com