使用 XAML 进行模态导航

模态页面可以通过三种方式创建:

  • NavigationPage 对象获取全屏页面
  • 对于警报和通知
  • 对于弹出菜单的 ActionSheets

全屏模态

...
// to open
await Navigation.PushModalAsync(new ModalPage());
// to close
await Navigation.PopModalAsync();
...

提醒/确认和通知

...
// alert
await DisplayAlert("Alert title", "Alert text", "Ok button text");
// confirmation
var booleanAnswer = await DisplayAlert("Confirm?", "Confirmation text", "Yes", "No");
...

ActionSheets

...
var selectedOption = await DisplayActionSheet("Options", "Cancel", "Destroy", "Option 1", "Option 2", "Option 3");
...