Remove back entry in windows phone mango

2019-05-01 04:52发布

how can i remove back stack in wp7.1.I have 3 pages and say A,B,C when i navigate from A to B and in B there is a button to add new contact detail.when i click it page navigate to page C and In page C there is a Done button and when i clicked done button the page navigate to home page that is the page A and when i clicked back button from page A.the page C is visible since it is not finished.How can i clear the back stack.Also let me know is there any method to clear a particular page from the back stack.if the back stack contain page A,B,C,D and i have to clear the last two pages that is C and D.is that possible in the windows phone Mango?

1条回答
迷人小祖宗
2楼-- · 2019-05-01 05:14

On the Load Event of the main page, put the following code:

while (NavigationService.CanGoBack)
{
    NavigationService.RemoveBackEntry();
}

I'm not sure whether it's a good practice, but since in Mango users are supposed to close their apps by clicking the back button, I think it's a good way to avoid backing the whole history.

查看更多
登录 后发表回答