user3599830
user3599830

Reputation: 25

how to refresh a page in visual studio?

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.

Upvotes: 0

Views: 104

Answers (1)

Matt Lacey
Matt Lacey

Reputation: 65564

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
    }
}

Upvotes: 2

Related Questions