Search code examples
c#windows-phonexamarin.forms

Navigation on Windows Phone with Xamarin.Forms


I am using Xamarin.Forms to write a cross platform app.

To change between Pages I am using Navigation.PushAsync(new Page());. This works fine when there is a NavigationPage.

Now I want to get rid of the NavigationPage on Windows Phone 8.1, because it is destroying my layout.

The Xamarin.Forms guides note, that you do not need a NavigationPage on Windows Phone.

Also note that the Windows Phone platform provides navigation natively. Therefore, you do not need to use a NavigationPage object to get navigation on that platform.

Bu when I do not use a NavigationPage, an Exception will be thrown.

enter image description here

So what can I do to use Navigation without NavigationPage on Windows Phone?


Solution

  • You can use PushModalAsync if it is disturbing your layout. I don't why such a statement in Xamarin site, because all navigations are handled by adding a navigation page.

    https://developer.xamarin.com/api/member/Xamarin.Forms.INavigation.PushModalAsync/p/Xamarin.Forms.Page/