我正在开发一款Windows手机应用程序。我已将样式添加到Pivot Item
。
<phone:PhoneApplicationPage.Resources>
<Style TargetType="phone:Pivot">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<Grid/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="phone:Pivot">
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Background="#D62429" CacheMode="BitmapCache" Grid.RowSpan="2" />
<Grid Background="{TemplateBinding Background}" CacheMode="BitmapCache"
Grid.Row="2" />
<ContentPresenter ContentTemplate="{TemplateBinding TitleTemplate}"
Content="{TemplateBinding Title}" Margin="25,10,0,0" />
<Primitives:PivotHeadersControl x:Name="HeadersListElement"
Grid.Row="1" />
<ItemsPresenter x:Name="PivotItemPresenter"
Margin="{TemplateBinding Padding}" Grid.Row="2"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
它显示如下
我正在尝试更改Pivot Item
以及Pivot Title
的字体大小和字体系列,即欢迎
和第1项。如何更改这些字体大小和字体系列?
答案 0 :(得分:6)
尝试以这种方式定义数据透视项目:
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Pivot Control-->
<controls:Pivot Title="WELCOME" FontSize="30" FontFamily="Arial">
<!--Pivot item one-->
<controls:PivotItem >
<controls:PivotItem.Header>
<TextBlock Text="item1" FontSize="30" FontFamily="Arial" Margin="0,30,0,0"/>
</controls:PivotItem.Header>
<Grid/>
</controls:PivotItem>
<!--Pivot item two-->
<controls:PivotItem >
<controls:PivotItem.Header>
<TextBlock Text="item2" FontSize="30" FontFamily="Arial" Margin="0,30,0,0"/>
</controls:PivotItem.Header>
<Grid/>
</controls:PivotItem>
</controls:Pivot>
</Grid>
答案 1 :(得分:0)
很抱歉由于某些原因我无法看到您的图片,但我最近回答了非常类似的问题。看看这是否有帮助:
答案 2 :(得分:0)
若要更改数据透视表头的字体大小或字体系列,请在数据透视表中使用此代码
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<Grid >
<TextBlock FontFamily="Times New Roman" Text="{Binding}" FontSize="20" Height="auto"/>
</Grid>
</DataTemplate>
</phone:Pivot.HeaderTemplate>