4
votes

As the title says, I have a problem with the IRegionNavigationJournal's GoBack method. First of all my scenario:

2 Prism Modules 1 Prism Shell with content Region

I only navigate via RegionManager.RequestNavigate("region", "ModuleName"). Additionally I register the View and the view's ViewModel in the unitycontainer with the ModuleName

One of the modules is the dashboard module where the second module (and every further module) registers a navigateto command. This command requests a navigate to module 2.

Everything works fine, the dashboard requests the navigate into the content region, gets displayed and renders the module 2's navigateto command.

After clicking the navigateto command of the second module, the second module gets displayed in the content region.

Additionally every module injects a GoBack command into the shell to perform IRegionNavigationJournal.GoBack plus module specific stuff inside the OnNavigateTo method.

Every ViewModel implements INavigationAware (to be exact this is implemented in a base viewmodel). Inside OnNavigatedTo I save the NavigatioService. After raising the GoBack command of module 2 the last action performed is the call of OnNavigateFrom of module 2. The OnNavigateTo of the dashboard never gets called. The module 2's view stays in the contentregion and thats it.

If I debug the application, the IRegionNavigationJournal's backstack says 1 entry with Uri "DashBoard".

Some code snippets:

register types:

container.RegisterType<object, DashboardViewModel>(new  ContainerControlledLifetimeManager());
container.RegisterType<object, DashboardView>(ModuleResources.ModuleName,
            new ContainerControlledLifetimeManager());

request navigate:

regionManager.RequestNavigate(ShellRegionNames.ContentRegion, ModuleResources.ModuleName);

go back:

 navigationService.Journal.GoBack();

Hope anybody can help.

Thanks in advance

1

1 Answers

1
votes

Seems like the string in the RegisterType<T> method has to be the same as the classname of the view. A RequestNavigate(RegionName, ViewName) works with different strings, bit the GoBack() doesn't.