[FIXED] Xamarin Forms Hide a Button on iOS and Show it on Android

Issue

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 the visibility of the controls.

Thanks

Solution

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

Or

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

Answered By – Zroq

Answer Checked By – Marie Seifert (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published