Pavan V Parekh Pavan V Parekh - 1 month ago 13
C# Question

How to navigate one Content page to another Content page from client project (IOS/Android) in xamarin forms?

How to navigate one content page to another content page from client project in xamarin forms?

I have done implementing push notification in each platform in different way. I need to navigate to another content from current content page.

i try to use below code in GCMService's OnMessage method.
My Problem is Second navigation content page's constructor are called and debug successfully. but my screen still display current page not to display second navigation content page.

App.Current.MainPage.Navigation.PushAsync (new SecondNavigationContentPage());

Answer Source

"Main Page" has to be a navigation page in order to navigate with the push pop navigation. You have a couple of options.

Option 1:

Swap out MainPage with your new page and use content pages.

App.Current.MainPage = your new content page

Option 2: (Probably the better option)

Make App.Current.MainPage a NavigationPage rather than a ContentPage then push your first content page to it. When you need to go to the second content page use the push navigation architecture.

App.Current.MainPage = new NavigationPage;