質問

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.

役に立ちましたか?

解決

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
    }
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top