I'm trying so hard to do something but i wasnt able to solve this problem. I have three pages, One is the MainPage, LoginUpPage and SignUpPage, inside of LoginUpPage has a button who navigates to SignUpPage, what i want to do is when I finish my logic navigates to another page CreatedPage, whitch contains a Label with a Message - Success and then after 2 seconds GoBack to the LoginPage, the problem is if I press the backbutton from device it will return to the last page that has the label with a message and I don't want that. I have a toobar with a BackButton to return to each page that i navigates. So far I have this:
LoginPage to SignUpPage :
Navigation.PushAsync(new SignupPage());
SignUpPage to CreatedPage :
await Navigation.PushModalAsync(new Created());
And inside of CreatedPage in my Contructor, this Method :
public async void Redirect()
{
await Task.Delay(TimeSpan.FromSeconds(2));
await Navigation.PushAsync(new LoginPage());
}
I know by this question there's basically three ways to navigate to another page :
Navigation.PushAsync(new OtherPage()); // to show OtherPage and be able to go back
Navigation.PushAsyncModal(new AnotherPage());// to show AnotherPage and not have a Back button
Navigation.PopAsync();// to go back one step on the navigation stack
At the same question has a example how to remove from a page from stack but it doesn't work.
item.Tapped += async (sender, e) => {
await Navigation.PushAsync (new SecondPage ());
Navigation.RemovePage(this);
};