Several questions about UICompositionQuickStart

Topics: Prism v4 - Silverlight 4
Jun 22, 2012 at 3:09 PM
Edited Jun 22, 2012 at 3:50 PM

I've got several questions about the UICompositionQuickStart project:

  1.  It's Application_StartUp method is empty, shouldn't it be (new UICompositionBootstrapper()).Run()?
  2. The ShellView class constructor receives it's view model. How does it work. Who is sending the ShellViewModel as a parameter to the ShellView constructor?. As a matter of fact, all Views in this project work the same way. I like this approach, but I need to know how it works.
  3. It's modules catalog Uri is defined as "/UIComposition.Shell;component/ModulesCatalog.xaml", in other examples I just see CreateFromXaml(new Uri("ModulesCatalog.xaml", UriKind.Relative));, why the dufference?, What benefit do I get from specifying the shell in the ModulesCatalog Uri?


Jun 22, 2012 at 7:44 PM


I'll try to answer you questions in order:

1. Based on my understanding the Application_Startup method in App.xaml.cs, defined in the main project (in this case UIComposition.Shell project) is the one that creates and runs the QuickStart's bootstrapper as you mentioned. Hence, I believe you may be lookind at the App.xaml file of the module project which is not used for this.

2. This functionality is achieved by benefiting from the use of a dependency injection container. As you might find in the applications bootstraper, CreateShell method the ShellView class is resolved from the application's container, in this case Unity. When resolving a type from the container, this will also resolve the parameters defined in its constructor (e.g. ShellViewModel).

If you are interested on how the Unity container works, I believe you could check the following resources:

Also, for more information about the approaches used in the UI Composition Quickstart to compose its UI, you could check the following chapters of the Prism documentation:

3. Based on my understanding, this definition is used to define the specific location of your ModuleCatalog, as far as I know when creating a Silverlight application defining this will be necesary, as your relative path will be pointing to the top level of the XAP file and not the project where your ModuleCatalog resides. Perhaps, the examples you have seen were WPF applications and the module catalog in this applications were defined in its startup project, hence just defining the module's catalog name in the URI was enough.

I hope you find this helpful,

Agustin Adami

Jun 23, 2012 at 2:50 AM

Thank you Agustin. I'll check those resources...