Search code examples
c#xamlwindows-phone-8fontslistpicker

How to set Font in ListPicker FullScreen Mode


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

I have tried to use this code but fullscreen List Picker still comes in default font. how to set font in this?


Solution

  • I think you are missing one from following:

    • first of all check your font name is same as you are using in code
    • have you set font property Build Action -> Content
    • Check for its location you are giving in code is right or not

    just use FontFamily Property like this:

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

    It is in folder: \Assets\Fonts\Agency FB Regular.ttf and set Build Action "Content" and its working for me.

    Sample Image