我想修改pivot项的标题字体而不影响其内容的字体,我尝试创建自定义样式,并使用HeaderTemplate属性将其链接到pivot控件,但我仍然无法使其工作。任何人都可以帮助>
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="HeaderTemplate">
<ContentPresenter>
<TextBlock Text="{Binding}"/>
</ContentPresenter>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Pivot Control-->
<phone:Pivot Title="MY APPLICATION" HeaderTemplate="{StaticResource HeaderTemplate}">
<phone:PivotItem Header="about">
<!--Double line list no text wrapping-->
</phone:PivotItem>
</phone:Pivot>
答案 0 :(得分:0)
尝试:
<phone:Pivot>
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"
Style="{StaticResource HeadTitleStyle}"
Margin="0,12" />
</DataTemplate>
</phone:Pivot.HeaderTemplate>
</phone:Pivot>
TextBlock 样式:
<Style x:Key="HeadTitleStyle"
TargetType="TextBlock">
<Setter Property="Foreground"
Value="" />
<Setter Property="FontFamily"
Value="" />
<Setter Property="Margin"
Value="" />
</Style>