Forum Xamarin.Forms

UWP font size

In our application, we have set font size to Micro, Small, Medium, Large. However the font size are various resolution to resolution 480 x 800 (wvga), 768 x 1280 (WXGA), 720 x 1280 (720p), 1080 x 1920 (1080p).

For a label, if we set font size to Micro and run the application in all four resolution size are not adjusting. Same works fine in android and iOS

Please share me any idea how to handle.

Is it possible to handle style based on the resolution.


  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Can we see the styles where you are defining these sizes?
    I assume you are defining them in XAML, probably as part of defining Styles, and using OnPlatform - is that right?

  • SivaShankarArumugamSivaShankarArumugam USMember ✭✭✭

    yes you are right.

    FYR Attached the sample Xaml used in app.

    <Application.Resources> <ResourceDictionary>' '<OnPlatform x:Key="FontRegularMedium" x:TypeArguments="Font"> <OnPlatform.iOS>OpenSans-Regular,12</OnPlatform.iOS> <OnPlatform.Android>OpenSans-Regular.ttf#OpenSans-Regular,14</OnPlatform.Android> <OnPlatform.WinPhone>Assets/Fonts/OpenSans-Regular.ttf#OpenSans,Micro</OnPlatform.WinPhone> </OnPlatform>

        `<Style x:Key="HEADER_MPID" TargetType="Label">
                <Setter Property="FontAttributes" Value="None" />
                <Setter Property="TextColor" Value="White" />
                <Setter Property="Font" Value="{DynamicResource FontRegularMedium}" />


    <Label Text="{Binding ObjSessionModel.Userid}" Style="{StaticResource HEADER_MPID}" HorizontalOptions="StartAndExpand" VerticalOptions="FillAndExpand" YAlign="Start"/>

    Font size is not changing based on resolution.

    Note : Custom Font

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    I don't know where you're getting your XAML examples, but some of it is long out of date.
    YAlign for example is obsoleted.

    You say you're trying to set font size but you're style is really setting font, along with size. I've never done it that way. I keep font and size separate.

                <OnPlatform x:Key="HeaderFont"
                            iOS="Large" />
                <OnPlatform x:Key="LargeFontSize"
                            iOS="44.0" />
Sign In or Register to comment.