private async void Button_Clicked(object sender, EventArgs e) { Page newRoot = null; var btn = (Button)sender; if (btn.Text == "ViewA") { newRoot = new ViewA(); } else { newRoot = new ViewB(); } await _navPage.Navigation.PushAsync(newRoot); IsPresented = false; }
private async void Button_Clicked(object sender, EventArgs e) { Page root = _navPage.Navigation.NavigationStack[0]; await _navPage.Navigation.PopToRootAsync(false); Page newRoot = null; var btn = (Button)sender; if (btn.Text == "ViewA") { newRoot = new ViewA(); } else { newRoot = new ViewB(); } await _navPage.Navigation.PushAsync(newRoot); _navPage.Navigation.RemovePage(root); }