I am newbie in using Prism. I have created a sample application to understand it. I have some queries on, how it is working.
Question 1:
public class HelloModuleCls : IModule { IRegionManager regionManager; IUnityContainer container; public void Initialize() { RegisterViewAndServices(); // Injecting occurs here if (regionManager.Regions.ContainsRegionWithName("ViewHolder")) { regionManager.Regions["ViewHolder"].Add ( ***container.Resolve().View*** ); } } protected void RegisterViewAndServices() { //since angular brace is not appearing, I am using ( , ).... container.RegisterType(IHelloView, HelloViewUC)(); container.RegisterType(IHelloViewModel, EmployeeVM)(); } } public class EmployeeVM : INotifyPropertyChanged, IHelloViewModel { public EmployeeVM(IHelloView targetview) { } }
Upon hitting the line, container.Resolve().View, the ctor of the VM, gets executed with, view type got injected in the param "targetview".
1. So, what will happen behind the scene, when that line got a hit...?
Question 2: Project Name:- HelloModule (Another Silvelight Class Library referred in the startup Silverlight Application)
public class HelloModuleCls : IModule { public HelloModuleCls(IRegionManager rm, IUnityContainer um) { regionManager = rm; container = um; } }
(Shell.Xaml) (In Startup Silverlight Application)
<ContentControl Prism:RegionManager.RegionName="ViewHolder" Grid.Row="0">
</ContentControl>
This Module is in another project. I am having the Region in the startup project. I have seen that, in the ctor of the HelloModuleCls, the region got which is used in the Startup project, got injected perfectly...
2. So, how the prism is passing those regions..... Is it like, once the region got created, then it will be injected to all the available Modules ctor or some other concept.
May I kindly know, how this is working out, So I can able to understand more.
Thanks in advance.