2

我正在開發一個Windows Phone應用程序。我已將樣式添加到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> 

這表明這樣的

enter image description here

我試圖改變字體大小和字體Pivot Item家庭也Pivot Title歡迎項目1。如何更改這些字體大小和字體系列?

回答

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> 
+0

@AjayPunekar我相信這必須被標記爲答案,因爲它工作得很好。 –

+0

geetha,不錯的代碼。保持!! –

0

更改字體大小或轉動頭使用的字體家族這段代碼透視裏面

<phone:Pivot.HeaderTemplate>     
      <DataTemplate> 
       <Grid > 
        <TextBlock FontFamily="Times New Roman" Text="{Binding}" FontSize="20" Height="auto"/> 
       </Grid>     
      </DataTemplate> 
</phone:Pivot.HeaderTemplate> 
相關問題