Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clear the Navigation stack?

Tags:

I have problem for Navigation in my app. I use xamarin.forms how can clean my navigation stack. No use Pop and push. Can I see my full navigation stack ?

like image 325
Ibrahim Avatar asked Feb 12 '15 12:02

Ibrahim


People also ask

How do I reset my navigation stack?

To reset the navigation stack for the home screen with React Navigation and React Native, we can use the navigation. dispatch and the CommonActions. reset methods. import { CommonActions } from "@react-navigation/native"; navigation.


1 Answers

In the latest version of Xamarin.Forms you can see your navigation stack using

Navigation.NavigationStack 

therefore you could use a

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

This code would have to go into your code behind of a Navigation Page or something that implements INavigation.

More information Xamarin.Forms.INavigation Members

like image 163
User1 Avatar answered Oct 20 '22 15:10

User1