Resource Dictionary for UWP/macOS and fonts

EnricoRossiniEnricoRossini USMember ✭✭✭✭

Hi guys,
I want to use a custom font for my app. I copied the font files in:

  • iOS: under Resources - Build Action BundleResource / Copy to Output Directory: Do not copy
  • Android: under Assets - Build Action Androd Asset / Copy to Output Directory: Do not copy
  • UWP: under Assets/Fonts - Build Action Content / Copy to Output Directory: Do not copy

I have two problems here. First is the UWP error:

Position 11:25. No property, bindable property, or event found for 'UWP', or mismatching type between value and property

The second is how to show my custom font.

Visual Studio 2017

My Xamarin.Forms version is 3.4.0.1029999

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    You are using the older usage , use this instead ,

       <OnPlatform x:Key="sss"  x:TypeArguments="x:String" >
                <On Platform="Android" Value="ssss"/>
                <On Platform="iOS" Value="dsds"/>
                <On Platform="UWP" Value="ghdfgh"/>
            </OnPlatform>
    

    Detailed documentation here : https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/text/fonts

  • EnricoRossiniEnricoRossini USMember ✭✭✭✭
    edited February 1

    @ColeX said:
    You are using the older usage , use this instead ,

       <OnPlatform x:Key="sss"  x:TypeArguments="x:String" >
                <On Platform="Android" Value="ssss"/>
                <On Platform="iOS" Value="dsds"/>
                <On Platform="UWP" Value="ghdfgh"/>
            </OnPlatform>
    

    Detailed documentation here : https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/text/fonts

    The problem is what you can see in the following picture:

    The property 'Default' is set more than one.

    The interesting thing is I can see all of the options in the Intellisense

  • ColeXColeX Member, Xamarin Team Xamurai

    @EnricoRossini said:

    @ColeX said:
    You are using the older usage , use this instead ,

       <OnPlatform x:Key="sss"  x:TypeArguments="x:String" >
                <On Platform="Android" Value="ssss"/>
                <On Platform="iOS" Value="dsds"/>
                <On Platform="UWP" Value="ghdfgh"/>
            </OnPlatform>
    

    Detailed documentation here : https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/text/fonts

    The problem is what you can see in the following picture:

    The property 'Default' is set more than one.

    The interesting thing is I can see all of the options in the Intellisense

    Don't mind that warnings , that's the known issue , but it works fine .

Sign In or Register to comment.