Loading Default View (Dashboard) when PRISM/WPF/UNITY/MVVM application

Topics: Prism v4 - WPF 4
May 9, 2012 at 10:54 PM

Hello all,

I have a shell with 2 regions, one is main region, the other is menu region where I would place Icons for the user to launch the appropriate module. 

I am struggling with the following.  I am trying to load a default view (standard user control) that can be treated as a dashboard for the user when they log into the application.  This view is in the same assembly as the Shell.  

I know I can handle this using the Loaded event on the shell window, but I do not want to do that since I am trying to use MVVM and I do not want to do that in the view.  

Any suggestions on how I can load the view automatically into main region of the shell?

Thank you in advance.

Developer
May 10, 2012 at 2:29 PM
Edited May 10, 2012 at 2:30 PM

Hi,

Based on my understanding of your scenario, as your UI components are not loosely coupled (as they are located on the same assembly) using a region for this view might not be necessary, as you should be able to directly compose your shell view with your default view.

An example of this can be seen in the Basic MVVM Quickstart which compose its MainPage with an Usercontrol (QuestionnaireView) which is located in the same assembly.

If placing this view in a region is required for your scenario, then I believe you could benefit from the "view discovery approach" provided by Prism to register your view in the region, this way your view will be shown when that location is displayed at run time. For example this registration could be done from your shell view model.

You could find more information about this approach in the following chapter of the Prism documentation:

Regards,

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