Custom font won't work in LongListSelector RRS feed

  • Question

  • I have this code in XAML:

            <DataTemplate x:Key="QuoteItemTemplate">
                <Grid Margin="0,5,0,0">
                    <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Quote}" FontFamily="ExistenceLight.ttf#Existence Light" FontSize="26" VerticalAlignment="Top" />


    my font is in project direction, the path and the name of the font are correct. If i put a textblock outside a longlistselector quoteitemtemplate i get my font...

    HELP PLEASE! I'm desperate!

    Sunday, August 11, 2013 5:39 AM

All replies

  • I can't reproduce the problem. Custom fonts work for me in LongListSelector DataTemplates. Does it work if you use a different custom font?

    When I look on the web, I see the font file named as Existence-Light.ttf (with a dash in the name). Are you sure that your local file doesn't have a dash?

    Richard Woo
    • Edited by mSpot Inc Sunday, August 11, 2013 7:58 AM
    Sunday, August 11, 2013 6:48 AM
  • i tried with - it wont show in LongListSelector.... 

    Monday, August 12, 2013 6:12 AM
  • I don't have any problem:

    1. Open a new Windows Phone project. Select the Windows Phone Databound App template and Windows Phone 8.0 version.
    2. I obtained an Existence Light font from here: http://www.dafont.com/existence.font (click on the download button). Extract Existence-Light.ttf from the zip file.
    3. Add Existence-Light.ttf file to the root level of the project. Change its Build Action property to Content.
    4. In MainPage.xaml, set the LineOne TextBlock in the DataTemplate to use the Existence Light font:
      <TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" FontFamily="Existence-Light.ttf#Existence Light"/>
    5. Run the project:

    I also tried moving the DataTemplate out to a page resource (as in your example) and the result was the same.

    My only other suggestion is to set the font file with Build Action as Resource (instead of Content), and use the appropriate path for a resource:
        FontFamily="/DataBoundApp1;component/Existence-Light.ttf#Existence Light"
    (replace DataBoundApp1 with the name of your assembly).

    Richard Woo

    • Edited by mSpot Inc Monday, August 12, 2013 8:58 AM
    Monday, August 12, 2013 8:48 AM
  • I'm doing this in Pivot page but it might not work because i don't have a MVVM class, but i do things like this


    I have a class Note.xaml and Note.xaml.cs

    In Note.xaml i designed the app

    In Note.xaml.cs i have the notes.add(new Note("This is note")); wich are binding in longlistselector datatemplate...

    and i tried everything u did tell me in databound it works, but in my app it won't... 

    but when I add a text box on the screen and add FontFamily="Existence-Light.ttf#Existence Light" it shows and it works in debug mode... 

    I'm giving up hope on this case :/

    Tuesday, August 13, 2013 4:06 AM
  • You haven't provided enough information to analyze your situation. Can you create a simplified example that would allow others to reproduce your issue?

    Did you try my suggestion of changing the ttf file's Build Action to Resource?

    Richard Woo
    Wednesday, August 14, 2013 5:12 PM