Xamarin.forms OnPlatfom

UraitzOlaizolaUraitzOlaizola USMember
edited August 2017 in Xamarin.Forms

Hi i would like to do something like this:

    <StackLayout Padding="15,0">
        <OnPlatform x:TypeArgumets="View">
              <On Platform="iOS">
        <Label Text="ios label" />
      </On>  
              <On Platform="Android">
        <Label Text="android label" />
     </On>
        </OnPlatform>
  </StackLayout>

Is there any TypeArguments which allows me to add custom elements for each platform?
thanks

Answers

  • UraitzOlaizolaUraitzOlaizola USMember
    edited August 2017

    May be the clearest xaml could be add some StackLayout and set IsVisible for each platform, like this:

                <StackLayout.IsVisible>
                    <OnPlatform x:TypeArguments="x:Boolean" iOS="false" Android="true" WinPhone="false" />
                </StackLayout.IsVisible>
    

    Any other suggestions?

    Thanks!

Sign In or Register to comment.