Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

DisplayAlert not working in IOS ?? with Xamarin.Form

$
0
0

Why my Alert do not working in IOS but in Android i working????
page.DisplayAlert(mess, "Enter any username and password" + mess, "OK");

there my solution..............

public partial class Login: ContentPage
{

    LoginViewModel viewModel; 


    public Login () 
    {
            InitializeComponent ();  
        viewModel = new LoginViewModel (); 

                    BindingContext = viewModel;

    }

}

my XAML

          <Button Text="Login" Command="{Binding OnLoginClicked}" />



public class LoginViewModel : ViewModelBase
{ 


    public ICommand OnHelpClicked
    {
        get{ return onHelpClicked ?? (onHelpClicked = new Command(() =>  DisplayAlert()) {
        });}
    }


    private void DisplayAlert()
    {
       page = new ContentPage();
        var mess = "";
        //if()
        //  mess = "Android";
        if(Device.OS == TargetPlatform.Android)
            mess = "Android";
        if (Device.OS == TargetPlatform.iOS)
            mess = "IOS";
        //#if __IOS__
        //    mess = "IOS";
        //#endif


       page.DisplayAlert(mess, "Enter any username and password" + mess, "OK"); 

  }

}


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>