Prism 4 Region Navigation without Dependency Injection

Topics: Prism v4 - WPF 4
Oct 16, 2011 at 1:35 PM

Hi

During navigation, does the Region navigation service implementation dependent on the presence of a DI framework for creating a target view that is not found in a Region?

Is there a hook where I can take over and provide the requested instance using "new"?

Regards,

-Itai


Developer
Oct 17, 2011 at 3:00 PM

Hi,

When navigating to a view in a region, once the navigation request is confirmed, the RegionNavigationContentLoader.LoadContent method should load the view that is target of the navigation request into the region. If none of the views in the region can be the target of the navigation request, a new view is created calling the RegionNavigationContentLoader.CreateNewRegionItem method, which requests a type of Object from the container (through the serviceLocator) with a name that matches the one supplied in the navigation URI.

Based on the aforementioned, you could try modifying the RegionNavigationContentLoader.CreateNewRegionItem method to retrieve your view using any mechansim you consider appropriate (such as a shared service, or reflection) to obtain the views based on the navigation contract.

I hope you find this helpful.

Agustin Adami
http://blogs.southworks.net/aadami


Oct 17, 2011 at 5:08 PM

Thanks.