locked
Page name navigated from

    Question

  • Hi,

    I cant find anything online on how to get the page name of the xaml page that I navigated from.  I want in the page load or similar method to get the page name of which I navigated from i.e. the page that sent me to this page.  I thought it would be in the onnavigatedto method but it doesn't seem to be.

    Any ideas?

    Thanks for any help. 

    Thursday, October 09, 2014 11:10 PM

Answers

  • Hello,

    Add the page name as the parameter of Frame.Navigate method like below.

    private void btn_Click(object sender, RoutedEventArgs e)
            {
                this.Frame.Navigate(typeof(Page1), this.ToString());
            }
    

    Add an override medhot of Page1’s OnNavigatedTo event, get the previous page name from e object like the following.

    protected override void OnNavigatedFrom(NavigationEventArgs e)
            {
                string pagename = e.Parameter.ToString();
                base.OnNavigatedFrom(e);
            }
    

    If I misunderstand you, please feel free to let me know.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Ireland75 Friday, October 10, 2014 9:14 AM
    Friday, October 10, 2014 6:30 AM
    Moderator

All replies

  • Hello,

    Add the page name as the parameter of Frame.Navigate method like below.

    private void btn_Click(object sender, RoutedEventArgs e)
            {
                this.Frame.Navigate(typeof(Page1), this.ToString());
            }
    

    Add an override medhot of Page1’s OnNavigatedTo event, get the previous page name from e object like the following.

    protected override void OnNavigatedFrom(NavigationEventArgs e)
            {
                string pagename = e.Parameter.ToString();
                base.OnNavigatedFrom(e);
            }
    

    If I misunderstand you, please feel free to let me know.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Ireland75 Friday, October 10, 2014 9:14 AM
    Friday, October 10, 2014 6:30 AM
    Moderator
  • Great...thanks for that Herro!
    Friday, October 10, 2014 9:14 AM