使用 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");
...