【问题标题】:How to set Font in ListPicker FullScreen Mode如何在 ListPicker 全屏模式下设置字体
【发布时间】:2014-09-06 05:03:24
【问题描述】:

<DataTemplate x:Name="PickerItemTemplate">
    <TextBlock Text="{Binding BackGroundColorString}" />
</DataTemplate>

<DataTemplate x:Name="PickerFullModeItemTemplate" >
    <Grid x:Name="rootGrid" Margin="0" Background="Transparent">

        <StackPanel Orientation="Horizontal"  Margin="0 14 0 0" Background="#FF030C34" >
            <TextBlock Name="BackgroundColor" 

                       Text="{Binding BackGroundColorString}"
                       Margin="0 0 480 0" 
                FontSize="{StaticResource PhoneFontSizeLarge}" 
                       TextAlignment="Left"
                      Foreground="White"
                       FontFamily="/Sunder Gutka;component/Assets/Fonts/AGENCYR.TTF#Agency FB"

                       />

        </StackPanel>
    </Grid>
</DataTemplate>

我已尝试使用此代码,但全屏列表选择器仍采用默认字体。这个怎么设置字体?

【问题讨论】:

    标签: c# xaml windows-phone-8 fonts listpicker


    【解决方案1】:

    我认为您缺少以下内容:

    • 首先检查您的字体名称是否与您在代码中使用的相同
    • 你是否设置了字体属性Build Action -> Content
    • 检查您在代码中提供的位置是否正确

    只需像这样使用 FontFamily 属性:

       <TextBlock FontFamily="/Assets/Fonts/Agency FB Regular.ttf#Agency FB"/>
    

    它在文件夹中:\Assets\Fonts\Agency FB Regular.ttf 并设置构建操作“内容”及其为我工作。

    【讨论】:

      【解决方案2】:

      增加TextBlock中的字体大小FontSize="25"使用这个代码。

      <TextBlock  Text="{Binding}" FontSize="25" Margin="10,10"/>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多