Xamarin.Forms WPF Custom fonts

AbhijitDeshpandeAbhijitDeshpande INMember ✭✭
edited August 2018 in Xamarin.Forms

My custom fonts (inside X.Forms) in iOS, macOS are working perfectly as detailed in the documentations
I added a WPF project (VS2017) as per documentation and MainPage.XAML contents are visible except the custom font

MainPage.XAML contains only one label with custom font set. Here are the steps I did in WPF project

  1. Inside the WPF project, created a folder named Assets/Fonts. Added a TTF file.
  2. Set the build action to Content + Copy Always
  3. In the MainPage.xaml (of XForms), added the following
<Label Text="Hollywood Hills" FontSize="24" TextColor="Silver" x:Name="customFontText">
                <OnPlatform x:TypeArguments="x:String" >
                    <On Platform ="WPF">Assets/Fonts/HollywoodHills.ttf/#Hollywood Hills</On>
                    <On Platform="iOS, macOS">Hollywood Hills</On>
  1. Even tried starting with /Assets.....
  2. But no luck

Best Answer


Sign In or Register to comment.