I am having problem using INavigationAware codes. I have 3 pages. For example I named it pageA, pageB and pageC. PageA is a list view and I will pass the parameter to pageB using OnItemSelected
PageA View Model
public void OnItemSelected(Complaint item)
{
if (item != null)
{
var param = new NavigationParameters();
param.Add("id", item.Id);
mNavigationService.NavigateAsync("pageB", param);
}
}
In pageB, i will get the parameter using OnNavigatedTo.
PageB View Model
public async void OnNavigatedTo(NavigationParameters parameters)
{
var id = parameters["id"];
Title = string.Format("{0}: {1}", Strings.ComplaintDetail_Title, id);
await getComplaintDetail(Convert.ToInt32(id));
}
From pageB, I will send the parameter to pageC using the same way. But right now, I am having problem with passing the parameter back to pageB. Since I am using INavigation Back button on the left top, I don't know how to pass the parameter back to pageB. The issue is I need to pass the parameter (primary key) to all pages for select and update purposes. Please help me. I'm not sure how to pass the parameter using OnNavigatedFrom.
PageC View Model
public void OnNavigatedFrom(NavigationParameters parameters)
{
}
Thank you in advance.
I hate to state the obvious, but have you tried adding to the parameters collection in the OnNavigatedFrom method?
public void OnNavigatedFrom(NavigationParameters parameters)
{
parameters.Add("test", "testValue");
}