Open start form and close all other Forms

At the start of my project I open a Dashboard form, each time I am calling other forms with the Navigation.PushAsync. But when the User logs out I want to close all forms and stacks and open my Dashboard again without going back option. How do i do this?

Answers

  • seanydaseanyda GBMember ✭✭✭✭✭

    You would need to clear the NavigationStack to go back to the original page.

    var navigationPages = Navigation.NavigationStack.ToList();
    foreach(var page in navigationPages)
    {
        Navigation.RemovePage(page);
    }
    

    Use System.Linq Where to filter out exactly what you want to remove.

  • FaithFaithFaithFaith USMember ✭✭

    Hi seanyda, so do I push the Dashboard page after this?

Sign In or Register to comment.