Hello,
Welcome to Microsoft Q&A!
How to access PushAsync in cs file not the xmal.cs?
Definitely we can call App.Current.MainPage.Navigation.PushAsync
anywhere in project .
But first of all , we should put the App.Current.MainPage
into navigation stack , in other word , the MainPage
should be wrapped into NavigationPage
.
Normally the solution is to set NavigationPage in App.cs , MainPage = new NavigationPage(new TabbedPage1());
.
However , if you just want TabbedPage
to be the root page , you can use (App.Current.MainPage as TabbedPage).CurrentPage.Navigation.PushAsync(xxx);
(CurrentPage should be placed in naviagtion stack as well).
Best Regards,
Cole Xia
If the response is helpful, please click "Accept Answer" and upvote it.
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.