WP7: navigate twice back

一世执手 提交于 2019-12-23 12:17:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!