0
votes

We're trying to convert a plain old ViewModel first with DataTemplates project into the world of Prism using the current IoC provider Ninject.

I've created an implentation of IServiceLocater and Bootstrapper. Navigation and registering views with regions works fine. Also ViewModelLocator.AutoWireViewModel sets up our ViewModels fine. The problem I'm facing is that even though I set IRegionMemberLifetime.KeepAlive to true and return true when IsNavigationAware.IsNavigationTarget is queried viewmodels are never reused. Simply browsing back in the journal causes Prism to resolve a new instance of the ViewModel. Does anyone have a reference implementation of how to correctly use Ninject with Prism or should I just give up and switch to Unity?

1
well have you've got an example with unity where it's working? I think it's rather easy to convert it to a working prism-ninject configuration... - BatteryBackupUnit

1 Answers

1
votes

Views and ViewModels that are considered for navigation need to have the same short or long class name as base name of the navigation Uri.

The thing that went wrong for me is that I had StartView linked to the name "Start". This means that the StartView in the IRegion history was not considered a navigation target for navigation target "Start".