简体   繁体   中英

Windows phone 7 navigation synchronous

In Windows Phone 7 C#, I need to show a page and, when the page performs NavigationService.GoBack(), execute some code:

Save();
NavigationService.Navigate(new Uri("/Add.xaml", UriKind.Relative));
Reload();

But Reload() it's executed when the page in showed! How I can make the program wait for the page closing for run Reload()??

Thanks

The best approach is to use the OnNavigatedTo method.

override void OnNavigatedTo(NavigationEventArgs e)
{
    if(e.NavigationMode == NavigationMode.Back)
    {
        Reload();
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM