简体   繁体   中英

Windows Phone App navigation issues

I have an application in which within one page i hit a web service and take response and save it into database and shown data into the list. next i have a refresh button to refresh and load the list again from web service. while refreshing if i click the device back button, then i am not redirected to the desired page instead it closes the application.

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
   {
     Dispatcher.BeginInvoke(() =>
      {
       NavigationService.Navigate(new Uri("/MyApp/MSample.xaml", UriKind.Relative));
      });     
   }

pressing the back button takes you to the previous page, if it exists, otherwise you leave the app. As far as I know, it's not recommended to change this behavior as it would be confusing for users

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