I was searching for tricks to make my Xamarin Forms app faster, and I came across this article. Well, I have tried out some options there but I am finding it difficult to achieve the last option that says;
- Pre-Load screens: This improved by a lot the performance on the app itself what we did is load on each screen, on background, the views and view-models that where needed next, so when pushing them onto the navigation stack they were already loaded. This reduced by a lot the time on transition between pages.
This seems to me as a good option and what I have done is to insert pages I maybe needing next onto the Stack before navigating to the page like so; however, I don't know if I am doing this the right way.
public ProductHomePageViewModel()
{
Application.Current.MainPage.Navigation.InsertPageBefore(new TilePage(), Application.Current.MainPage.Navigation.NavigationStack[0]);
}
But this doesn't work well when it is done on a homepage where a click of a back button should exit the app. But in this case clicking the back button navigates to the next page on the stack.
Please assist me on how to pre-load pages. Any advice is good. Thank you!