Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to change the default font size?

$
0
0

I need to change the default font size of the app, how can I do that?
I am open to different options:

  1. Ideally, if possible, set a different font size to 12, and have FontSize="Small", FontSize="Large" etc. automatically scale based on my new Default size (probably just a big hope).
  2. Set font sizes in App.xaml and then use them as
  3. I want to set a different size for Phone and Tablet

This is what I tried, but it doesn't work
App.xaml:

<OnIdiom x:Key="defaultFontSize"  x:TypeArguments="x:Int32">
    <OnIdiom.Phone>12</OnIdiom.Phone>
    <OnIdiom.Tablet>14</OnIdiom.Tablet>
</OnIdiom>

<Style TargetType="Label">
    <Setter Property="FontSize" Value="{StaticResource defaultFontSize}"></Setter>
</Style>

Main.xaml:

<Label Text="Testing the font size"></Label>

but my text "Testing the font size" just looks the same (i also tried increasing the size to 30 to make sure).

If I do this instead, it throws an exception:
<Label Text="Testing the font size" FontSize="{StaticResource defaultFontSize}"></Label>

Is it possible to achieve what I am trying to do? Thanks


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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