Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove back entry in windows phone mango

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?

like image 456
Sujiz Avatar asked Sep 27 '11 10:09

Sujiz


1 Answers

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.

like image 76
Tuco Avatar answered Sep 29 '22 12:09

Tuco