locked
Back stack issue when navigating from list item of List view RRS feed

  • Question

  • Hi All,

    We are facing an unique issue when navigating from list item. The situation is as below

    1) I have a list of items displayed in List view

    2) On clicking the list view item,  we are taking a id and moving to a detailed page that shows the detailed content. We are using Frame.Navigate (typeof(DetPage)) in the selection event.

    3) In the detailed page when we click the Hardware back button, the expected behavior is that it will invoke the code in Detailed page first. But we have a strange behavior. The page that has ListView (from where we stared the traversal) is invoked first.

    I need some insights on why this is happening and how it can be prevented ?

    Thanks and regards


    Venkatesh. S|MCTS(WCF, ADO.NET 3.5)|eMail: heman_1978@hotmail.com

    Thursday, July 10, 2014 1:32 AM

All replies

  • If you want to invoke any of your code when user clicks on back button in your 'DetPage' then you have to either override the OnNavigatingFrom or you have to register an event with Back key press button.

    public DetPage()// constructor

    {

    ...

    ...

    HardwareButtons.BackPressed += HardwareButtons_BackPressed;

    }

     void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
            {
               //write your code here

             //Even you can prevent back navigation by setting 'e.Cancel=true;'

            }

    You have write this in your 'DetPage'


    Srini



    • Edited by Srini b Friday, July 11, 2014 9:59 AM
    Friday, July 11, 2014 9:58 AM