Hello,
INavigation.PopModalAsync Method is an awaitable asynchronous method, you could not use xxx.PopModalAsync().Result
, and you don't have to find the App.Current.MainPage.Navigation
. As noted at the Xamarin.Forms Modal Pages doc : A NavigationPage instance is not required for performing modal page navigation.
For example;
Setting MainPage in App class:
public App()
{
InitializeComponent();
// MainPage = new NavigationPage(new MainPage());
MainPage = new MainPage(); // the pop up and dissmiss appearance is same whether you set NavigationPage or not
}
Clicking button on MainPage
to pop up the Page1
(your addStaff page)
private void Button_Clicked(object sender, EventArgs e)
{
Navigation.PushModalAsync(new Page1());
}
Dissmiss action on the Page1
(your addStaff page)
private void Button_Clicked(object sender, EventArgs e)
{
Navigation.PopModalAsync();
}
Best Regards, Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.