×

Discussion Board

Results 1 to 3 of 3

Hybrid View

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    1

    Back key behavior

    I've developed an application with a main screen and a list screen. If I select something from the list, screen, I'm automatically returned to the main screen. However if I press back at this point, I back into the list screen, rather than backing out of the application. Is there a better solution than overriding the back button on that screen to throw an unhandled exception?

  2. #2
    Regular Contributor
    Join Date
    Jan 2009
    Location
    India
    Posts
    138

    Re: Back key behavior

    Hello Jerry,

    As far as I understand your problem you want below mentioned navigation in your application.
    S1 = Main screen
    S2 = List screen
    Exit = Exit from

    Linear navigation structure:
    S1 -> S2 -> S1 -> Exit

    For your solution you can use Non-Linear navigation using NavigationService.RemoveBackEntry(); API when you select something from the list screen and automatically returned to the main screen that time you can call this API.

    S1 -> S2 -> (select item that time you have to call NavigationService.RemoveBackEntry() this method will remove the S2 stack entry) - > Exit (on Back key Press)


    However you can also override OnBackKeyPress method see below.

    Code:
    protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
     {
                    base.OnBackKeyPress(e);
     }
    Pavan Pareta
    Sr. Software Engineer
    http://windows-mobile-dev.blogspot.com

  3. #3
    Registered User
    Join Date
    Oct 2010
    Location
    Trivandrum ,Kerala
    Posts
    139

    Re: Back key behavior

    using System.Windows.Navigation;

    protected override void OnBackKeyPress(CancelEventArgs e)
    {
    base.OnBackKeyPress(e);
    // back button and other navigation no longer work after the e.Cancel = true.
    }
    sreerajvr

Similar Threads

  1. how to show back-to--back messages
    By satishchauhan in forum Mobile Java General
    Replies: 4
    Last Post: 2009-01-30, 05:46
  2. Exit on back key when app is in back ground
    By Anurag Bansal in forum Symbian
    Replies: 8
    Last Post: 2008-09-18, 10:29
  3. Play 3gp back to back seemlessly
    By murthy.pramod in forum Streaming and Video
    Replies: 1
    Last Post: 2008-08-05, 12:51
  4. How to play back to back video
    By murthy.pramod in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2008-08-04, 08:09
  5. Back-to-back video clip playback
    By malmrose in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2005-07-22, 20:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×