FontSize - On platform

SteeveLeDreauSteeveLeDreau ✭✭FRMember ✭✭

Hi guys i can't find any information about how to create a style or a resource in app.xaml of type FontSize.
They are example with enum type in code behind (Large, Medium, Small...), they are exemple with Double value sometimes int.
Whatever i do, my font size remains the same whereas all other style are applied.

Maybe since 1.3 you don't have to use onplatform yet because xamarin provide a converter that converts this double into point/pixel/inch depend on the platform ?

Posts

  • SteeveLeDreauSteeveLeDreau ✭✭ FRMember ✭✭

    I can't trust that nobody ever achieve that ?! :smiley:

  • SteeveLeDreauSteeveLeDreau ✭✭ FRMember ✭✭
    edited February 2015

    You can do : (i typed <_Style because without the _, this code ditor eats my lines of code)

    <_Style x:Key="MyLabel" TargetType="ctrls:Label">
    <_Setter Property="FontFamily">
                    <Setter.Value>
                                   <OnPlatform x:TypeArguments="x:String">
                                                   <OnPlatform.iOS>MarkerFelt-Thin</OnPlatform.iOS>
                                                   <OnPlatform.Android></OnPlatform.Android>
                                                   <OnPlatform.WinPhone></OnPlatform.WinPhone>
                                   </OnPlatform>
                    </Setter.Value>
    </Setter>
    

    <_/Style>

    But you can’t do :
    <_Style x:Key="MyLabel" TargetType="ctrls:Label">
    <_Setter Property="FontSize">
    <Setter.Value>

    <OnPlatform.iOS>18</OnPlatform.iOS>
    <OnPlatform.Android>18</OnPlatform.Android>
    <OnPlatform.WinPhone>26</OnPlatform.WinPhone>

    </Setter.Value>
    </_Setter>
    <_/Style>

    Any idea why ? is it a bug ?

  • LuckyDayLuckyDay ✭✭✭ USMember ✭✭✭

    @SteeveLeDreau Sorry, just saw this. Is this still an issue for you? What version of the platform are you on?

    I reported this bug awhile ago to bugzilla and it was fixed in a XF update so maybe updating would fix the issue for you.

Sign In or Register to comment.