PivotItem标题字体不会更改。属性设置为内容。此字体适用于我的应用程序的其他区域,但不适用于PivotItem标头。
<controls:Pivot Margin="0">
<controls:PivotItem Header="Welcome" FontFamily=".Fonts/sketch123.ttf#sketch123">
</controls:PivotItem>
答案 0 :(得分:0)
添加到ResourceDictionary(没有基元:)并根据需要进行编辑(适用于Windows Phone 8.1商店)
<x:Double x:Key="PivotHeaderItemFontSize">57</x:Double>
<x:Int32 x:Key="PivotHeaderItemCharacterSpacing">-25</x:Int32>
<FontFamily x:Key="PivotHeaderItemFontFamily">Segoe WP SemiLight</FontFamily>
<Thickness x:Key="PivotHeaderItemPadding">0,0,0,6.5</Thickness>
<Thickness x:Key="PivotHeaderItemMargin">16,-6.5,0,0</Thickness>
<Style TargetType="primitives:PivotHeaderItem">
<Setter Property="FontSize" Value="{ThemeResource PivotHeaderItemFontSize}" />
<Setter Property="FontFamily" Value="{ThemeResource PivotHeaderItemFontFamily}" />
<Setter Property="CharacterSpacing" Value="{ThemeResource PivotHeaderItemCharacterSpacing}" />
<Setter Property="Background" Value="{ThemeResource PivotHeaderBackgroundUnselectedBrush}" />
<Setter Property="Foreground" Value="{ThemeResource PivotHeaderForegroundUnselectedBrush}" />
<Setter Property="Margin" Value="{ThemeResource PivotHeaderItemMargin}" />
<Setter Property="Padding" Value="{ThemeResource PivotHeaderItemPadding}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="primitives:PivotHeaderItem">
<Grid x:Name="Grid">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Unselected"
GeneratedDuration="0:0:0.33"
To="UnselectedLocked" />
<VisualTransition From="UnselectedLocked"
GeneratedDuration="0:0:0.33"
To="Unselected" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Unselected" />
<VisualState x:Name="UnselectedLocked">
<Storyboard>
<DoubleAnimation Duration="0"
Storyboard.TargetName="ContentPresenterTranslateTransform"
Storyboard.TargetProperty="X"
To="{ThemeResource PhonePivotLockedTranslation}" />
<DoubleAnimation Duration="0"
Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="(UIElement.Opacity)"
To="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Selected">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotHeaderForegroundSelectedBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource PivotHeaderBackgroundSelectedBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="ContentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}">
<ContentPresenter.RenderTransform>
<TranslateTransform x:Name="ContentPresenterTranslateTransform" />
</ContentPresenter.RenderTransform>
</ContentPresenter>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
for Sirverlite
答案 1 :(得分:0)
之前尝试过,但它没有用。我最初必须输错。这有效:
<controls:PivotItem >
<controls:PivotItem.Header>
<TextBlock Text="welCome" FontFamily="Heart Breaking Bad" FontSize="80" Margin="24,20,20,0"/>
</controls:PivotItem.Header>