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

前端 未结 6 1462
天命终不由人
天命终不由人 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 14:57

    For anyone that stumbles upon this question seeking for the codebehind solution:

                switch (Device.RuntimePlatform)
                {
                    case Device.iOS:
                        //iOS specific code here
                        break;
                    case Device.Android:
                         //Android specific code here
                        break;
                }
    

    The Device class has the following Device constants:

    Constants as shown from VS 2019 Intellisense.

提交回复
热议问题