I have a simple Xamarin forms based application which submits an application to a service, upon which I want to clear the navigation stack, so that a new application can be entered. I'm using the MVVM Light framework but the built in navigation service has no method clear the stack.
I know this is possible with out of the box Xamarin using Navigation.RemovePage, but not sure how to implement this within MVVM Lights navigation service.
I have the following in the NavigateTo method using parameter as an indicator to clear the stack:
if (parameter == null)
{
foreach (var pageList in _navigation.Pages)
{
//Remove from navigation stack
}
}
I was hoping I could fire something from here to clear the stack so that the pages are refreshed, or is there a better way of doing it, possibly from the viewmodel directly?
Thanks
_navigationfield is aXamarin.Forms.NavigationPage, you could just use_navigation.PopToRootAsync()- Frauke