0
votes

I would like to make it possible for users to make text size bigger in my App and thereby easier to see the texts.
I don't want to do this inside my App setting when both iOS and Android have this directly build inside the OS.

On Android the Xamarin Forms Label, Entry, etc. text sizes adjust according to Android text size setting. But that is not the case, when I try the same App on iOS.

How do I make this work on iOS?

Examples would be great :-)

1
Have you tried to bind the Font size ? Not sure if it works , but i think it worths the try then you can change it based on the platform from the viewmodelAhmad ElMadi
@BraveHeart No, I haven't tried that. It's not the platform that I need to depend on, but the platforms general Text size (which works on Android). Do you have any ideas to that? :-)Mrtnld

1 Answers

1
votes

You can define global style inside App.Xaml like this:

<OnPlatform x:Key="Font_Small" x:TypeArguments="x:Double" iOS="12" Android="10" />
<OnPlatform x:Key="Font_Medium" x:TypeArguments="x:Double" iOS="16" Android="14" />
<OnPlatform x:Key="Font_Large" x:TypeArguments="x:Double" iOS="20" Android="18" />

<Style TargetType="Label" x:Key="ListHeaderTextStyle">
    <Setter Property="TextColor" Value="Black" />
    <Setter Property="FontSize">
        <Setter.Value>
            <OnIdiom x:TypeArguments="x:Double" Tablet="{StaticResource Font_Large}" Phone="{StaticResource Font_Medium}"/>
        </Setter.Value>
    </Setter>
</Style>

For just example I have added few font sizes you can define your own and use as per requirement.