0
votes

I know in Xamarin we can use Tabbed page, Carousel page... but I wonder that if I open every new page like this:

Application.Current.MainPage = new MyPage();

Is this a bad approach? Is this effect performance or any other things?

2

2 Answers

1
votes

Basically when you use PushAsync, it adds the new page on top of the navigation stack. The navigation stack is a LIFO you can manage using PushAsync, PopAsync or the back button. So when you use PopAsync, it removes the last page from the stack (as it does using the back button).

Using Application.Current.MainPage = new MyPage(); for opening every page, you are just overriding the very first element of the stack and therefore you are not able to use back navigation at all since you would always keep one single page into the navigation stack.

Moreover, with this approach, clicking on the back button will exit the app.

0
votes

You can do this as long as it works for you. However it may cause some problems, especially that you can't use the system back function in any way. Also you may lose some animations that should be part of the standard UI and that are considered as a good practice.