Forum Cross Platform with Xamarin

OnPlatform assistance

Hi Al

I'm busy following a Xamarin forms tutorial and building an app as per guidelines in the tutorial (image attached of tutorial steps). I don't have an "OnPlatform" option in my App.xaml but I do have a "On Platform" not sure if I'm missing a library or something. Secondly in my MainPage.xaml if I type the FontSize="{StaticRecource " I'm supposed to get an option for "FontSizeSmall" but I only get an option for "key". here are my code snippets, please can someone tell me what I've missed or doing wrong.

App.xaml
<?xml version="1.0" encoding="utf-8" ?>

<Application.Resources>

    <!-- Application resource dictionary -->
    <ResourceDictionary>

        <OnPlatform x:Name="FontSizeSmall"
                    x:TypeArguments="x:Double"
                    Android="14.0"
                    WinPhone="16.0"
                    iOS="16.0" />

    </ResourceDictionary>

</Application.Resources>

MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>

<Label Text="Welcome to Xamarin Forms!" 
       VerticalOptions="Center" 
       HorizontalOptions="Center"
       FontSize="{StaticResource ????} " />

Many thanks
AJ

Answers

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    but I do have a "On Platform"

    Not sure how that's possible. A space between the words would make them two terms.
    Can you show a screenshot of that?

  • AlexjamesAlexjames ZAMember ✭✭



    Hi Clint

    Thank you for your response, I have attached the screen grabs as requested. Could I be missing a library ?

    Many thanks
    AJ

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭
    edited August 2017

    I would say to not worry about what Intellisense is popping up. Just type <OnPlatform x:Key=.... and keep going

    Secondly in my MainPage.xaml if I type the FontSize="{StaticRecource " I'm supposed to get an option for "FontSizeSmall" but I only get an option for "key"

    Also... The directions show using x:Key="FontSizeSmall but you're typing x:Name="FontSizeSmall - Its 'key' not 'name'

  • GrantMeyerGrantMeyer USMember ✭✭

    Aahhh Thanks Clint, I'll test it out this evening and let you know.

    Thanks again for the assistance.

Sign In or Register to comment.