SilverLightweight Prism Framework
is a lighweight framework to be used as a generic starting point for a Silverlight/Prism project.
This project is meant to serve as a quick start for developers looking to implement a Silverlight/Prism application. It is not meant to be a tutorial on Silverlight/Prism frameworks. There are many sites out there that offer great insight on the various parts
of a Prism framework.
Main parts of a Prism Framework
(as far as code is concerned):
The SLIP solution is broken down into 3 main projects/assemblies:
- Container (SLIP uses the Unity container)
- Bootstrapper: Initializes the catalog of modules for the application along with the shell.
- Shell: Main content holder for the application. All modules will be loaded into specific regions within the shell.
- Modules: Application specific components.
- Events: Communication/Interaction between modules.
This contains the bootstrapper and shell.
This contains two core classes that help in creating modules using the MVVM pattern and a generic Event class.
- SLIPViewBase: Base class for your module’s view.
- SLIPViewModelBase: Base class for your module’s ViewModel.
- SLIPEvent: This class is used as a generic event.
This contains Example/Test modules.
The Bootstrapper is the first object loaded for the application. It will configure the container by registering types for the application modules.
It also initializes the shell by placing initial modules into specfic regions.
(You can choose one of the pre-defined shells, or create your own):
This is a basic shell with a top left button that brings up a menu region. It also has one main region.
This is a basic shell with one main region.
Extends NotificationObject, this gives subclasses access to create Dependency Properties in a much easier manner, as well as having the now built in DelegateCommand for Command Binding from the View to the ViewModel.
Extends UserControl. This is essentially responsible for connecting the View to its underlying ViewModel.
This class is used as a generic event. It contains a string for a key and an object for data. Using this class, modules that subscribe to this event, will be notified. If the key in the event is what the module is listening for, it can take
the data object and do work.
Used as a main tester for the framework, it creates a basic event that other modules can subscribe to.
Similar to TestView, used to subscribe/receive a basic event from TestView.
To add a new module, you can create a new project for your assemblies:
- In the new project, add a reference to SLIP.Core.
- Create your IViewModel and ViewModel classes. Be sure to extend from SLIPViewModelBase.
- Create your UI View Classes. Be sure to extend from SLIPViewBase.
- Add assembly reference of your new project to the SLIP project.
- In the Bootstrapper, initialize and add your module to the container catalog and the shell.
This project should be used by developers who want to get a quick understanding of creating an application using Prism for Silverlight.