Reputation: 1144
I started Xamarin.Forms and it is great with MVVM pattern.
As main page I use NavigationPage and navigate with PushAsync and PopAsync brteen different pages. This works great if the phone stays in the same orientation. If I rotate screen, Xamarin shows always the first page after rotation.
How can I prevent this? I want to support the screen rotation and don't loose the navigation stack after rotation.
Upvotes: 0
Views: 293
Reputation: 2398
This is possible when running Android. Make sure that your MainActivity class has the ConfigurationChanges
attributes. Here is an example:
[Activity(Label = "MYProject.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
Upvotes: 1