问题
is there a way to navigate two pages back in Windows Phone 7? I know the URI, but I'd like to clear the navigation stack.
回答1:
Yes you can programmatically walk back the stack. I would recommend reading this guidance doc on this topic:
http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/solving-circular-navigation-in-windows-phone-silverlight-applications.aspx
Thanks, Stefan Wick - Microsoft Silverlight
回答2:
The easiest way to do this is like this:
NavigationService.RemoveBackEntry();
NavigationService.GoBack();
This doesn't exactly go back twice, it removes the previous page from the navigation stack, then goes back once, but the effect is the same.
回答3:
This could help you out in case you are trying to navigate to your home page.
int depth = NavigationService.BackStack.Count();
for (int i = 0; i < depth-1; i++)
{
NavigationService.RemoveBackEntry();
}
NavigationService.GoBack();
来源:https://stackoverflow.com/questions/5628237/wp7-navigate-twice-back