How to go to previous page in windows phone 8 when back button is pressed

I have a home page or landing page in my windows phone c# based app where user enters login details and upon successful login user is redirected to page2 . Here the user will see a list box with few items . Upon selecting an item from this list box a new
page called "Threadx" opens.(where x is the each page that opens upon clicking the x item in the list box)
While user is on this Thread page "Threadx" he may receive the toast notifications and the thread gets updated with new replies or answers on that thread.
But When user clicks on back button the "ThreadX" page doesn't get closed and instead it goes to its previous state where it has less number of messages , and so on until the app gets closed.
protected override void OnNavigatedTo(NavigationEventArgs e)
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.Back)
return;
I would like to know if this "Threadx" page can be closed upon clicking back button without affecting other "Threadx+1","Threadx+2"..."Threadx+n" pages.
Any help would be really appreciated.

you don't need to navigate explicitly. Just clear the back stack till your specific page and say goback. below is the  code you can use.
 protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
                    e.cancel=true;
                RemoveBackStackTillSpecificPage("page2.xaml");
                GoBack();
public static void RemoveBackStackTillSpecificPage(string pageName)
PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
var previousPage = frame.BackStack.FirstOrDefault();
if (previousPage != null && previousPage.Source != null)
                while (!previousPage.Source.ToString().Contains(pageName))
                    frame.RemoveBackEntry();
                    previousPage = frame.BackStack.FirstOrDefault();
        public static void GoBack()
            PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
            LastPageUri = frame.Source;
            frame.GoBack();
Please mark this as answer if this answers your question
Purushothama V S

Similar Messages

  • How to go to previous page in task flow using 'BACK' button in the browser?

    Hi...
    I have created system using ADF application that can detect 'BACK' button in the browser(e.g. firefox and google chrome).Everytime i click the 'BACK' button in the browser,it will prompt out message that ask user whether want to 'stay in the current page' or 'leave the page'. Once i click 'leave the page' it will take me to the login page.
    Is there any possibility for go back to previous page in task flow when user click on browser's back button? By the way, the task flow is in the page fragment.
    can anyone tell me how to do it?Need this step urgently..
    Thanks in advance.
    Edited by: 942376 on Jun 22, 2012 11:03 PM
    Edited by: 942376 on Jun 22, 2012 11:07 PM

    Can you send that code to have a look ? Share it on some site

  • Disable page display when back button is pressed after logout

    hi,
    I dont want the old pages to appear once the back button is pressed after loggin g out. That is .... when logged in, if the user presses back button then his previous pages must be shown....but once the user logs out and then if he presses back button then some message like session has been closed....like message should be displayed.
    Hope you understood the problem

    If you expire a page then back button will not take it to the previous page.
    expire is a HTTP-EQUIV meta tag in the header of the page. You can set the content to some time in the "past" when serving the page first time.
    Expires
    This tells the browser the date and time when the document will be considered "expired." If a user is using Netscape Navigator,
    a request for a document whose time has "expired" will initiate a new network request for the document.
    An illegal Expires date such as "0" is interpreted by the browser as "immediately." Dates must be in the RFC850 format, (GMT format):
    <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT"> Hope this works for you, there are browser dependencies as well.
    vr,
    Sudhakar B.

  • Ability to see multiple previous pages by dropdown next to Back button seems to have gone

    Since the recent update, I seem to have lost the little down arrow next to the Back button to enable me to jump to, say, 4 pages before the current one.
    Can I bring it back or has it disappeared for good?
    Thank you for any replies

    You're welcome.
    Please click the '''Helpful''' button next to the answer that solved your Firefox support issue, '''when you are logged in''', so this thread gets marked as '''Solved''' to help other users who may have this same problem.

  • How to retain the java applet generated code when back button is pressed!!

    I've a jsp page in which i've wirtten the code which specifies the word which i write in the text box, then through the applet i'm showing the word which is written in the text box. It means my applet is running and it show the words which i've written in the text box. Now when i click on submit it goes to the next page and when i click on browser's back button then except the applet generated code everyone retains its values. Is there any way to find it out when it encounter the back button click then applet should be restarted. so in this way without writing the whole application form and in the applet generated code i can submit it again.
    My question is how do i reatin the applet generated code when a click button is being pressed (b'coz for the textbox, textareas everything retains it)
    any suggestions or guidance are most welcome.
    thanks in advance....

    you don't need to navigate explicitly. Just clear the back stack till your specific page and say goback. below is the  code you can use.
     protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
                        e.cancel=true;
                    RemoveBackStackTillSpecificPage("page2.xaml");
                    GoBack();
    public static void RemoveBackStackTillSpecificPage(string pageName)
    PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
    var previousPage = frame.BackStack.FirstOrDefault();
    if (previousPage != null && previousPage.Source != null)
                    while (!previousPage.Source.ToString().Contains(pageName))
                        frame.RemoveBackEntry();
                        previousPage = frame.BackStack.FirstOrDefault();
            public static void GoBack()
                PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
                LastPageUri = frame.Source;
                frame.GoBack();
    Please mark this as answer if this answers your question
    Purushothama V S

  • How to forward a jsp page in flex application ( when a button is clicked)

    i am a fresher to this FLEX 2.0 , i designed the UI part in
    flex, but when i click the submit button it has to forward to the
    JSP page to check against the valid user,password , so how to
    forward the page to jsp(i mean from flex to jsp) , if u can suggest
    me with an example, it will be easy for me, is Flex Data Service 2
    is necessary for this
    thanks for ur speedy reply, hopping to get the solution for
    this issue,
    sandeep

    Your JSP is, as far as Flex is concerned, just a data service
    which it will request and read its response. I'd suggest using
    <mx:HTTPService>. For example:
    <mx:HTTPService id="authorize" url="validate.jsp"
    fault="handleFault(event)" result="handleResult(event)">
    <mx:request>
    <userid>{username.text}</userid>
    <password>{password.text}</password>
    </mx:request>
    </mx:HTTPService>
    Flex creates the request:
    http://{server}.{port}{context.root}/validate.jsp?userid=fred&password=flintstone
    assuming that you have <mx:TextInput id="username" />
    and <mx:TextInput id="password" /> components.
    Your Submit button then does: authorize.send()
    (note: you can also pass the request parameters in the send()
    method - check the Flex docs on HTTPService).
    Flex will listen for the response from your JSP. Typically a
    JSP would respond with an HTML page, but you don't want to do that
    for Flex. Your JSP should produce either a simple string ("yes" or
    "no" or "error" etc) or an XML document.
    The handleResult method can examine the response and do
    what's necessary.

  • How a to call a form from another form when the button is pressed

    Hi All
    I working with oracle apps r12
    I have develop a new form and attached into a special menu here i have two button
    When i click a button i need to call my new form.
    I have tried so far is
    I have write a trigger in that button when button pressed
    open_form('Form_name',Activate)
    regards
    Srikkanth
    Edited by: Srikkanth.M on Aug 18, 2011 7:06 PM

    Can you not use zoom functionality ?
    How to Zoom or Create Master-Details relationship Using Forms Personalization? (Doc ID 457643.1)
    HTH
    Srini

  • Setting internet home page on Windows Phone 7.5 No...

    How do you set internet home page on Windows Phone 7.5 Nokia Lumia 900?
    Baseline information:
    Phone Manufacturer: Nokia
    Phone Model: Nokia Lumia 900
    Mobile Operator: AT&T
    Software: Windows Phone 7.5
    Phone Operating System version: 7.10.8112.7
    Zune software version: 4.8.2345.0
    Computer Operating System version: Windows 7 Home Premium (x64) Service Pack 1 (build 7601)

    @RFNAPLES
    If you leave a webpage up there without closing it from the tabs it should always return, otherwise tap the "three dots" bottom right of screen and scroll down to"pin to start" and you will then have a new tile upon homescreen.
    Happy to have helped forum with a Support Ratio = 42.5

  • HT201272 How do I download previously purchased albums from iTunes when the album has either disappeared from my computer or the tunes are not playable?  The album shows as purchased on the iTunes store, but not available to download to my authorized devi

    How do I download previously purchased albums from iTunes when the album has either disappeared from my computer or the tunes are not playable?  The albums show as purchased on the iTunes store, but not available to download to my authorized device.  I also have albums that appear in my library, but are not able to be added to my iPod from my computer

    When you download something from the iCloud, it is a brand new licensed copy. Your iCloud account just contains a notation that you have this app. It isn't storing an actual copy of the app from your Mac.

  • How can I set the page that will open, when I open a new tab, to be the same as the homepage?

    How can I set the page that will open, when I open a new tab, to be the same as the homepage?
    An app changed it to some other search engine, before installing the app, I the tab that would open was the homepage I set.
    In my case it is Google, and I want my new tabs to open on Google like they did before the installation.
    thank you,
    Asaf Privman.

    You can middle-click or Ctrl left-click the Home button on the Navigation toolbar to open the Home page in a new tab.
    You can look at one of these extensions:
    * NewTabURL : https://addons.mozilla.org/firefox/addon/newtaburl/
    * New Tab Homepage : https://addons.mozilla.org/firefox/addon/new-tab-homepage/

  • How to get carrier company name on windows phone 8.1?

    how to get carrier company name on windows phone 8.1?

    excuse me, i referrer the link http://stackoverflow.com/questions/26973111/get-carrier-name-cellular-mobile-operator-name-using-windows-phone-8-1 to
    modify my universal app.
    but i always get 0 count from the GetNetworkNames() method. 
    if my sim card is for 3G, but i setting 4G in highest connection speed. i got the "the pipe is being closed".
    how can i solve the problem? thank you.

  • How do i transfer content from a windows phone to an iphone

    How do I transfer content from a windows phone to an iphone?

    Hi Julian,
    Sorry for the delay in response, I didn't think many answers would come in so quickly being Christmas and all...
    My Dad only needs to be able to access files for reference; any editing or alteration to pre-existing files would largely be done on a desktop or his laptop. In the meantime, Dropbox does look ideal and I will investigate along with the other great ideas suggested on here for the best option.
    Thanks very much...

  • How do you reorder the pages in a PDF ie back to front (not individually via Page view)

    Sorry if this is in the wrong place or if this has been answered elsewhere but I couldn't seem to search "the database"
    How do you reorder the pages in a PDF ie back to front (not individually via Page view). The manual solution of course is to scan or import them in the correct order in the first place. However, this did not happen, and we have many PDF's which are 100% in the wrong order. So we would like to press a button and have them in the right order.
    Many thanks in advance for your help...

    Got it to work. It returned a completely different path of course just to make life interesting and required a FN+OPTION ENTER in order to return the path. I now have the FLATTEN option in the edit menu.
    Just trying it checking all the Flatten options except the fields seemed to work on the first pass. I'm going to try and load a copy of the original complete document. I assume that is the proper way to use this at this point since I created the form ***-backwards?
    I've used Adobe layout programs since the Aldus days but Acrobat seems to work differently than any other program I've used.
    If I understand what you're saying I should:
    1. Design the layout of the form leaving spaces for the fields
    2. Open Acrobat, import the document
    3. Auto-add and correct, or manually add the fields
    4. Fix tabbing
    5. Add any additional comments or annotations
    6. Flatten everything but the fields?  (If the fields are flattened I can't fill out the form unless it's supposed to be a printed form only, right?)
    Might just have to break down and RTFM.  Acrobat is a really different animal.

  • HT1766 how do i delete previous backup for i phone

    how do i delete previous backup for i phone on i tunes on a comp

    Open itunes go to preferences then devices and the backups are shown.  Delete the one you don't want

  • Reloading a Page when Browser back button is pressed

    Hi There
    We are designing a web site in which all the pages are dynamic depending on what he does with his email and addressbook system. Problem is when the uers request a change to the his email accounts or addressbook entries he is sent to editable pages .After editing he is sent back to view page .Now when he uses the back button he sees the old record that he modifed which i dont want to do that Instead i want him to show the updated version of that page
    Now how to achieve this.
    Is there any way to send a request to the server everytime the back button is pressed.
    Also i am trying to remoce the cache using the code below but it does not work i just dont know why?
    response.setHeader("Cache-Control","no-cache"); // HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setHeader("Expires" , "0");
    Any help would be appreciated.
    Thanks.
    Mumtaz

    I also have noticed that in the latest version of Explorer it ignore the no-Cache header when the back button is pressed. Is this an undocumented "feature" put in place by MS or is there a newer header tag that needs to be set. The no-cache and expires tags work fine in Netscape and ealier versions of MS with my existing code. The version I am having difficulties with is 6.00
    Thanks

Maybe you are looking for