0
votes

The question can be really basic since I have little to no knowledge about Xamarin Forms. I have recently started working on an old Xamarin Forms project where I had to upgrade "Prism.Plugin.Popups" plugin to Version="7.2.0.1046" and “Prism.Unity.Forms" to Version="7.2.0.1422"

I had to Implement IInitialize Interface since INavigatingAware is deprecated in latest Prism framework as mentioned in https://github.com/PrismLibrary/Prism/issues/1858

Issue: I want app to navigate back from XPopupPage to AViewModel with the code _navigationService.GoBackAsync(navParams); which is working but Initialize function of AViewModel isn’t getting called once it comes back from XPopupPage.

Here’s the code:

AViewModel: 
public class AViewModel : BindableBase, INavigationAware, IInitialize { 
.... 
// Code to navigate to XPopupPageViewModel private void ShowPopup(object obj) 
{
_navigation.NavigateAsync($”{.....}”); 
} 
//NOT GETTING CALLED once it come back from XPopupPageViewModel 
public void Initialize(INavigationParameters parameters) { 
..... 
} } 
XPopupPageViewModel: 
public class XPopupPageViewModel : BindableBase, INavigationAware, IInitialize
{ 
//Code to navigate back to AViewModel private void Update(object obj)
{ 
.... 
var navParams = new NavigationParameters(.....); _navigationService.GoBackAsync(navParams); 
} }
1

1 Answers

0
votes

From the github issue you posted:

Use OnNavigatedTo when calling GoBack