How to invoke view of another module from a view of one module

Topics: Prism v4 - WPF 4
Mar 26, 2013 at 1:36 PM
How to invoke view of another module from a view of one module in Prism?

Hi all, I need to invoke a view of another module from a view of one module, for example, I have two mdi windows which contain different views from two modules. one has a grid that lists all orders, when user click one item of it, another mdi winodw that contains the order detail view from another module will display. how to make thisin Prism?

Could some help me?
Mar 26, 2013 at 5:56 PM

Based on my understanding, modules can't communicate directly between them. So in my opinion, in order to accomplish this task you have two possible options:

1 - Use Navigation. This way, you could call the RequestNavigate method from the region manager to show a view from a another module like this:
regionManager.RequestNavigate("MainRegion", new Uri("YourView", UriKind.Relative));
Note that you only need to know both the region and the view names to navigate, so you don't require to have an explicit reference between the modules. Also, remember that in order to be able to navigate to a view in a region, that view should be registered in the container accordingly.

Like this in Unity:
Or like this in MEF:
public partial class YourView : UserControl
2 - Inject EventAggregator to your ViewModels and use Publish and Subscribe methods to communicate between the modules.

For more information on Navigation and communicating between loosely coupled components, you can visit the following sections of the Prism documentation:
Hope this helps,

Federico Martinez
Mar 27, 2013 at 3:53 AM
Thanks Federico.