我不知道为什么DisplayAlert不起作用,如果我写page.Displayalert它也不起作用
使用System;
使用Xamarin.Forms;
使用UIKit;
命名空间test.project { public partial class ViewController:UIViewController {
partial void UIButton197_TouchUpInside(UIButton sender)
{
if(textBoxName.Text == "" && textBoxpasswd.Text == "")
{
await displayAlert("Hello");
}
}
protected ViewController(IntPtr handle) : base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
}
}
答案 0 :(得分:3)
就像Jason所说,是Page上的方法,但如果你真的需要,你可以试试这个:
await App.Current.MainPage.DisplayAlert ("Hello", "No");
答案 1 :(得分:0)
displayAlert。这应该是DisplayAlert。部分void UIButton197_TouchUpInside应该是异步的。