Friday, December 14, 2012

Windows Phone Application Back Key Press Navigation

Sometimes i was sturggling for the particular navigations on back key pressing over windows phone devices and have the solution as a cool effect feel free to use this override :)


  protected override void OnBackKeyPress

              (System.ComponentModel.CancelEventArgs e)
        {
            while (NavigationService.CanGoBack)
            {
                if (NavigationService.BackStack.First().Source.OriginalString == "/MainPage.xaml")
                {
                    break;
                }
                NavigationService.RemoveBackEntry();
            }


        }

1 comment: