Xamarin Forms Hide a Button on iOS and Show it on Android

前端 未结 6 1420
天命终不由人
天命终不由人 2020-12-31 14:23

How to hide a button, a label or a grid cell on iOS and show it on android, I have a xamarin.forms app (portable), I know that I have to use on platform but how to access th

6条回答
  •  礼貌的吻别
    2020-12-31 15:08

    // IOS, Android, WP
    SomeButton.IsVisible = Device.OnPlatform(false, true, true);
    

    Or

    if (Device.OS == TargetPlatform.Android)
    {
        SomeButton.IsVisible = true;
    }
    else
    ...
    

提交回复
热议问题