试图让一个displayalert显示在Xamarin中

时间:2016-08-05 23:56:20

标签: c# xamarin

我希望显示警告的应用程序页面是首次加载页面的时间。该页面正在使用StackLayout控件和页面上的几个按钮。

DisplayAlert("Question?", "Heave you entered your information before", "Yes", "No");

这就是我现在所拥有的,但它没有显示。我是否需要将它包含在布局中的儿童或其他内容中,谢谢你。

1 个答案:

答案 0 :(得分:0)

如果您想在页面加载时显示它,请将其放在OnAppearing方法

protected async override void OnAppearing ()
{
  base.OnAppearing ();

  // any other initialization code goes here

  await DisplayAlert("Question?", "Have you entered your information before?", "Yes", "No");
}