I have also mentioned how to solve errors most people have faced when starting with PRISM.

Prerequisites for this Project

Visual Studio 2010 onwards and Active Internet Connection (To download PRISM).

In this project I have used Visual Studio 2015.

What is PRISM?

Prism provides guidance to help you more easily design and build, flexible, and easy-to-maintain client business apps that run on Windows Runtime, Windows Presentation Foundation (WPF) desktop, Silverlight, or Windows Phone . These apps may start small and evolve over time.

Using design patterns that embody important architectural design principles, such as separation of concerns and loose coupling, Prism helps you to design and build apps that embody significant presentation and business logic that typically interact with back-end systems and services and, using a layered architecture, may be physically deployed across multiple tiers. It is expected that the app will evolve significantly over its lifetime in response to new requirements and business opportunities. In short, these apps are "built to last" and "built for change." Apps that do not demand these characteristics may not benefit from using Prism.

-MSDN

The article is divided into three parts:

Legend:

PART 1: Install PRISM and create a PRISM window

Code

  1. using Microsoft.Practices.Unity;
  2. using Microsoft.Practices.Prism.UnityExtensions;
  3. public class BootStrapper: UnityBootstrapper
  4. {
  5. protected override System.Windows.DependencyObject CreateShell()
  6. {
  7. return this.Container.Resolve < PrismAppShell > ();
  8. }
  9. protected override void InitializeModules()
  10. {
  11. base.InitializeModules();
  12. App.Current.MainWindow = (PrismAppShell) this.Shell;
  13. App.Current.MainWindow.Show();
  14. }
  15. protected override void ConfigureModuleCatalog()
  16. {
  17. base.ConfigureModuleCatalog();
  18. this.ModuleCatalog.AddModule(null); // (Placeholder)
  19. }
  20. }

PART 2 : Create UI Regions

PART 3: Create Modules and map them the predefined regions, ie Header, Body and Footer

And Voila !

Definitions

Dependency objects

Dependency object is the base object for all WPF objects. All the UI Elements like Buttons TextBox etc and the content elements like Paragraph, Italic, Span etc all are derived from Dependency Object.

Dependency objects are used for WPF property system. By default, what ever the property system we have in DOT Net CLR is very basic. But Dependency properties provide lots of additional features/services to support Data Binding.

Once you create any property as a dependency property, then automatically you get following feature implemented for you. ie. Change Notification, Validation, Call Back, Inheritance, DataBinding, Styles, Default Values etc.

Dependency injection

Dependency injection is a software design pattern that implements inversion of control for resolving dependencies. A dependency is an object that can be used (a service). An injection is the passing of a dependency to a dependent object (a client) that would use it. The service is made part of the client's state. Passing the service to the client, rather than allowing a client to build or find the service, is the fundamental requirement of the pattern.