Question

i have created a windows phone application. In each page i have given a back button using "NavigationService.GoBack()" command. i want that when the back button is pressed the previous page to which it navigate the whole code of that page must again be executed.

Was it helpful?

Solution

If you're relying the user pressing the hardware back button you shouldn't have to call GoBack() yourself.

To refresh a page when the user navigates back to it you can use the following in your page (and add the refresh code as appropriate):

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    base.OnNavigatedTo(e);

    if (e.NavigationMode == NavigationMode.Back)
    {
        // Do your refreshing here
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top