Animation when changing MainPage of the application

MikilllMikilll Member ✭✭✭
edited June 2018 in Xamarin.Forms

I am using a MasterDetail template and I also have a login page. In my app when I am logged out I have set:

MainPage = new LoginPage();

When I will successfully log in I am just changing MainPage to MasterDetailNavigation like this:

MainPage = new MasterDetailNavigation();

However, there is no animation (page transition) when I am changing MainPage. How can I add it? It would be great to have i.e. the same animation which is when we are doing:

Navigation.PushAsync(new SomePage())

How can I achieve this animation?


  • ManojkumarMaliManojkumarMali USMember ✭✭✭


    You can use following nuget packages;

  • MikilllMikilll Member ✭✭✭

    But how I achieve animation when I am just changing MainPage, not calling Navigation.PushAsync()?

  • MikilllMikilll Member ✭✭✭

    Still anybody no idea?

  • vecalionvecalion LVMember ✭✭

    Hey @Mikilll, did you solve this? I'm facing exactly the same issue.

  • MikilllMikilll Member ✭✭✭

    No. In Xamarin.Forms changing Main page looks ugly and for now, there is no solution.

  • lavilasolavilaso Member ✭✭

    Hi, I'm the last one in line waiting for a solution for this

  • LeoJHarrisLeoJHarris NZMember ✭✭✭

    What exactly is the question being asked here?

  • Umar3xUmar3x FRMember ✭✭✭

    The question being asked is : "How to animate when a new MainPage is set to the application".

    If you set a mainPage at runTime for example : typical use case would be a LoginPage (with a register tunnel) set as MainPage and when sucessfully logged in, changing the MainPage to your app's LandingPage. There is no animation at all, and depending on the type of page your pushing, you might see a blank screen for a few sec, which is kind of ugly.

  • lucidBrotlucidBrot Member ✭✭

    Push the page normally, then remove the underlying pages on the stack.
    Or add the new Main Page under the stack, then pop the stack down to it.

  • MattGoldmanMattGoldman USMember ✭✭

    @lucidBrot said:
    Push the page normally, then remove the underlying pages on the stack.
    Or add the new Main Page under the stack, then pop the stack down to it.

    This sounds like a good suggestion. Could you provide some guidance on how you might do this?

  • KhairulFLPMKhairulFLPM Member ✭✭

    Maybe we can try this hopefully..

    Navigation.InsertPageBefore(new YOURNEXTPAGE(), this);
    await Navigation.PopAsync(); <-- TO DELETE CURRENT PAGE

  • aga913aga913 Member ✭✭

    i know this is kinda late but i think its better for you to have the MainPage as MasterDetailNavigation
    and overriding the OnAppearing method and there you should push your loginpage
    about the animations topic i have no idea but you might wanna see some custom renders
    not sure but and other bloggers have such stuff at their pages so you might wanna search there...

Sign In or Register to comment.