Caliburn.Micro and MahApps.Metro project template
Project template for Caliburn.Micro WPF application using MahApps.Metro windows.
What it uses
- Caliburn.Micro is the chosen MVVM framework, to bind your ViewModels to your Views. If you're not already using MVVM, use it.
- MahApps.Metro provides a quick and easy way to get a nice-looking application from the start.
- MahApps.Metro.SimpleChildWindow (referenced but not used) will help you create nice-looking modal popups.
IPropertyChangednotifications are implemented using Fody.PropertyChanged. Just use
using PropertyChanged;and add the
[ImplementPropertyChanged]attribute to your ViewModel classes.
- NLog takes care of logging purposes; see
App.xaml.csfor a sample usage using
How to install
- Run the
generate.batfile. It will generate the Visual Studio template using the latest sources.
- Restart Visual Studio.
The template is now located in new project > Visual C#. You might need to enable Nuget package restore by right clicking on the solution file and selecting
Enable NuGet Package Restore.
Alternatively, you can use Visual Studio to generate the template :
- Open the CaliburnTemplate solution and make it so it can be built properly.
- Export the project as a template by following the steps under
Export template. Choose "project template" and the project CaliburnTemplate, add a name/description/symbol to it and check the
Import template into Visual Studiooption.
The sample logging is using the Caliburn.Micro logging facade, with the
Caliburn.Micro.Logging.NLog nuget package.
App.xaml.cs static constructor, the C.M logging is initialized by setting the LogManager
By default, when you're using the C.M logging facade to log, it logs every single C.M debug message. You might not want that. The provided nlog config file ignores the C.M messages (check the rules pointing to the nil logger). If you need the C.M debug messages, just comment out those lines.
If this configuration is not to your liking, either use another Caliburn logging nuget package, or create a new one.
A sample is provided in the
How it works
- A bootstrapper is registered in the
- This bootstrapper then loads the
AppWindowManagerinstantiates either the
BaseDialogWindow, which use MahApps.Metro
MasterViewModelis a Caliburn
Conductor, which means it only "wires" the screens together. By default, it loads the