Michael Itzoe
Michael Itzoe

Reputation: 1959

Get results from target page when returning to source page

My Windows Phone 7 app as a page with an edit form with a ListPicker control. One of the items in the list is "add new" which, when selected, opens another page with another edit form for adding a new lookup value. Problem is, page navigation is asynchronous, so when the source page navigates to the target page, code execution continues and I don't know how to get a notification from the target page when the user saves. I want the value they just added to be inserted and selected in the ListPicker on the source page. I'm not even sure how to look this up on Google.

Upvotes: 1

Views: 546

Answers (1)

Chris Sainty
Chris Sainty

Reputation: 9326

On your first page you will need to override the OnNavigatedTo method (or attach a second event handler)

protected override void OnNavigatedTo(NavigationEventArgs e) {
  // Check for state
}

Your second page will need to write a piece of state into a location both pages can access, then the first page can see if this state exists.
A simple Dictionary<string,object> off the static App object can be a starting point for this sort of state.

Upvotes: 1

Related Questions