Search code examples
c#xamlsilverlightwindows-phone-8navigation

windows silverlight app stuck on one page


In my windows phone app I am doing a scanning process, wherever I am in the app, when the scan button is pressed on my bottom appbar, I navigate to my scan page, known as ScanView.xaml.

Problem: I have overridden onnavigatedTo method of scanView to initiate scanning screen.

When I press back button while I am on the scanning screen It goes back to ScanView.xaml and hence onnavigatedTo method is again called and my scanning screen again appears.

What I want to do is, when I press back button while on scanning screen it should navigate directly back to my mainpage.xaml

P.S : I have tried overriding the backbutton handler, but it is still not working.

Here is my code.

protected override void OnNavigatedTo(NavigationEventArgs e)
    {   
        //this method is invoked as soon as we are navited to the ScanView         
        Scanning();  
    }

Thanks in advance


Solution

  • Just remove ScanView.xaml from the navigation stack (it is the item at the top of the stack) when navigated to the scanning page.