Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Xamarin.Forms WPF Custom fonts

$
0
0

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">
            <Label.FontFamily>
                <OnPlatform x:TypeArguments="x:String" >
                    <On Platform ="WPF">Assets/Fonts/HollywoodHills.ttf/#Hollywood Hills</On>
                    <On Platform="iOS, macOS">Hollywood Hills</On>
                </OnPlatform>
            </Label.FontFamily>
</Label>
  1. Even tried starting with /Assets.....
  2. But no luck

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>