Passing results back
In this chapter, we’ve explored passing parameters from one page to another during forward navigation. But what if we need to take an object, use it as a parameter to navigate to another page, manipulate it there, and then retrieve the updated result?
There are various approaches to achieve this, but the most straightforward method is to add a little extension to our navigation framework and allow parameters to be passed when navigating back. For example, on the SettingsPage
of the Recipes! app, we show the user’s current language. There’s a button that navigates to the PickLanguagePage
, where the user can select a different language. The current language needs to be passed from the SettingsPage
to the PickLanguage
page so that the latter can show the current value. When the user selects a new language, the PickLanguagePage
should navigate back to the SettingsPage
and pass the selected language as a parameter. Figure 8.2 shows how this looks...