delay in navigation

i have used await
if (await DisplayAlert("Register...", "You must Login to Access the Profile", "Login", "Cancle"))
{
await Navigation.PushAsync(new Login(viewName)
{
Title = "Login"
});
}
else
{

            await Navigation.PushAsync(new Sell((account[0]))
            {
                Title = "Sell"

            });



        }

for navigate,it takes long time to navigate to particulate page. please help me :(

Answers

  • JohnHardmanJohnHardman GBUniversity mod

    @PiumiWelahetti - What is in the constructor of the page that is slow to navigate to? Also, if anything, what is in the OnAppearing override of the page that is slow to navigate to?

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Also keep in mind that the first time a page appears there is a given amount of overhead. The page has to be calculated, rendered... bindings have to be evaluated and data fetched or controls hidden, etc.

    Since you are creating a new instance of your pages every time you push them, that means it all has to be re-calculated and re-rendered every time. If it is a page you are going to use a lot, you could make a singleton instance of the page and then re-push the same instance. You'll see a big improvement in speed after the first time the page is displayed.

Sign In or Register to comment.