我不知道为什么 DisplayAlert 不起作用,如果我写 page.Displayalert 它也不起作用
使用系统;
使用 Xamarin.Forms;
使用 UIKit;
命名空间 test.project { 公共部分类 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.
}
}
Run Code Online (Sandbox Code Playgroud)
}
小智 5
就像 Jason 所说,这是 Page 上的一种方法,但如果您确实需要,可以尝试以下方法:
await App.Current.MainPage.DisplayAlert ("Hello", "No");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1734 次 |
| 最近记录: |