locked
Continue in method when page is close RRS feed

  • Question

  • Hello everybody,

    a button on a pages opens another page. I make my selection on this page, and when I close this page, I want to continue past the NavigationService.Navigate... line in my code. Is this possible or can page1 recognize when page2 is closed?


    br

    Wednesday, January 29, 2014 10:24 PM

All replies

  • I'm not following what you're doing here.  Why wouldn't you just navigate to whatever page is next?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, January 30, 2014 2:11 PM
  • You can use variables between pages so Page1 can recognize that it is being returned to from Page2.  Using the OnNavigatedTo and OnNavigatedFrom events, you can read and write an application variable indicating the last page it was on and clear that variable after the test and conditional statements.

    Once the NavigationService.Navigate function is called, the calling function is effectively ended as any statements after that call will not run upon the return to the page.  (If the statements are run, it may not be when the page is returned, but as an asynchronous method.  Best is to have the Navigate as the last effective line in a function.)

    Friday, January 31, 2014 7:31 AM