- Obtain and Build the Code
- Setting Up a Project
Before Caliburn can be used on a project, it must be configured and initialized. The manual mechanism for configuration is through the CaliburnFramework class and is documented here
. However, there is another way to get started, with additional benefits. This is through the use of the CaliburnApplication base class. To use it, you must change your App.xaml.cs and App.xaml files as follows:
public partial class App : CaliburnApplication
The only difference between the WPF and Silverlight versions is the handling of the custom namespace.
When you inherit from CaliburnApplication, the base class will make sure the framework is configured and started correctly. Should you need to customize the configuration, simply override any of the following methods:
| Override || Purpose |
| CreateContainer || Allows the developer to specify their own IoC container and configure it appropriately. |
| SelectAssemblies || Allows the developer to tell Caliburn which assemblies should be inspected for components, views, commands, etc. |
| ConfigurePresentationFramework || Enables the developer to customize the most common aspects of the presentation framework services. |
| ConfigureCaliburn || Allows the developer to configure Caliburn's components with their own container. This is only necessary if the container adapter does not implement IConfigurator. |
Model First Development
Caliburn supports model-frist development through the optional overriding of CaliburnApplication.CreateRootModel. Using this override, the developer can return an instance of their root View Model (typically thought of as a Shell View Model). For WPF, Caliburn will use the IWindowManager to open the main window, configured with your root model. In Silverlight, the same process will occur, but the IViewStrategy and IBinder (used by the IWindowManager in WPF) will be invoked directly. The resulting bound view will then be set to App.RootVisual. If your root model implements the IPresenter interface, it's Initialize and Activate methods will be invoked accordingly. The WPF version will also insure proper shutdown of the root model. To customize the shutdown procedure, override CaliburnApplication.ExecuteShutdownModel.