Xamarin.Forms Navigation in Xamarin.Forms Modal navigation with XAML


Example

Modal pages can created in three ways:

  • From NavigationPage object for full screen pages
  • For Alerts and Notifications
  • For ActionSheets that are pop-ups menus

Full screen modals

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

Alerts/Confirmations and Notifications

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