c# - How to use a custom font with Windows Universal app? -
like other windows phone 8 projects wanted use custom font. new universal app architecture struggle put in place.
i have created "fonts" folder in shared project, added fonts files property build action "content".
i created "themes" folder in shared project , added resourcedictionnary ("generic.xaml").
i added fontfamily resource :
<fontfamily x:key="rexboldfontfamily">/fonts/rex bold.otf#rex bold</fontfamily>   i referenced in app.xaml that:
<application.resources>      <resourcedictionary>          <resourcedictionary.mergeddictionaries>             <resourcedictionary source="themes/generic.xaml"/>         </resourcedictionary.mergeddictionaries>          <vm:viewmodellocator x:key="locator" d:isdatasource="true" />      </resourcedictionary>  </application.resources>   in mainpage.xaml on windows phone project tried use this:
<textblock text="{binding helloworld}" foreground="{themeresource redbrush}" horizontalalignment="center" verticalalignment="center" fontfamily="{staticresource rexboldfontfamily}" fontsize="22"/>   i know sure name of font because works on 1 of windows phone app. , of wired because works color resource.
any 1 succeded share font , use it,
you're doing right, except font name (part after '#'). seems rex, not rex bold.
<fontfamily x:key="rexboldfontfamily">/fonts/rex bold.otf#rex</fontfamily>      
Comments
Post a Comment