RequestNavigate method does not find the view

Topics: Prism v4 - WPF 4
Jul 23, 2014 at 3:03 PM
RequestNavigate method is unable to find correct view in the following case:
  • I use View injection:
CustomView view = new CustomView();
string viewId = "MyDynamicId";
RegionManager.Regions[regionName].Add(view, viewId);
  • Next, I try to use RequestNavigate like this:
object view = RegionManager.Regions[regionName].GetView("MyDynamicId");
//Preceeding code works and give me correct view...

//But this code seems to not retrieve existing view because he try to create a new view
//although I use KeepAlive = true for the view
Precisions : I use Unity

Thanks a lot for your help, and tell me if I forgot some details to understand my problem.
Aug 4, 2014 at 2:41 PM
In my understanding, I think you will initialize the views using the Container.
You can't use CustomView view = new CustomView() yourself.

Please use container.RegisterType<object, CustomView>("CustomView"); in your module initializer.

or CustomView view = container.Resolve<CustomView>();

Hope this helps.