3

I just wanted to confirm my understanding of prism modules.

I my thought was a module may consist of many features with many views.

For example I want to create UserManagement module that consists of the following features which have their own main views

Features
* User Listing
* User Update
* Change Password

is my understanding of modules in prism correct? How would I tell the module manger to load which feature?

Or do I have this all wrong and each module can only have one main view?

Arcadian
  • 4,312
  • 12
  • 64
  • 107
  • All of the latest documentation for Prism can be found here: http://prismlibrary.readthedocs.io/en/latest/. Do not use the old MSDN docs for Prism, unless you are on an old version. The most current stable version is 6.2. – R. Richards Feb 16 '17 at 12:08

1 Answers1

4

is my understanding of modules in prism correct?

Yes, a module in Prism is simply a loosely coupled functional unit in form of a class library project that typically represents a set of related concerns and includes a collection of related components, such views, view models, models and other classes.

You would implement all functionality and UI that is related to the management of users in your application in the UserManagement module. You can read more about this on MSDN: https://msdn.microsoft.com/en-us/library/gg405479(v=pandp.40).aspx.

How would I tell the module manger to load which feature?

There are a bunch of code samples available on the official Prism site on GitHub: https://github.com/PrismLibrary/Prism-Samples-Wpf

The HelloWorld sample demonstrates how to load a module: https://github.com/PrismLibrary/Prism-Samples-Wpf/blob/master/HelloWorld/HelloWorld/Bootstrapper.cs

Or do I have this all wrong and each module can only have one main view?

No, a single module may certainly contain more than one view.

mm8
  • 163,881
  • 10
  • 57
  • 88
  • Do we have to specify the Region in the module view? What if I want the module view to load in any region? – Arcadian Feb 16 '17 at 14:49
  • The region is typically defined in the shell window. You can then use the RegisterViewWithRegion method to register the view in your module with this region. The HelloWorld sample that I linked to does exactly this: https://github.com/PrismLibrary/Prism-Samples-Wpf/blob/master/HelloWorld/Modules/ModuleA/ModuleAModule.cs. – mm8 Feb 16 '17 at 15:07
  • Right but you have to have the view in the module know the name of the region. That means the shell MUST have the region defined for the module view to load. – Arcadian Feb 16 '17 at 18:32
  • for example: _regionManager.RegisterViewWithRegion("MainRegion", typeof(ViewA)); that line is inside the view. It requires the shell to have a "MainRegion" defined. What if my shell wants it in a "OtherRegion" – Arcadian Feb 16 '17 at 18:33
  • Of course you must know in which particular region you want to register your view. – mm8 Feb 16 '17 at 19:46