/Caliburn.Metro

A library that combines MahApps.Metro with Caliburn.Micro for Metro UI styled WPF applications.

Primary LanguageC#The UnlicenseUnlicense

Caliburn.Metro

Library combines MahApps.Metro and Caliburn.Micro for Metro UI styled WPF applications

It provides Caliburn.Micro Bootstrapper and MahApps.Metro MetroWindow integrated WindowManager. Also project contains Autofac Bootstrapper integration.

Default Setup Demo application

  //Basic AppBootstrapper
  public class AppBootstrapper : CaliburnMetroCompositionBootstrapper<AppViewModel>
  {

  }
    
  //AppWindowManager with custom Main window
  [Export(typeof(IWindowManager))]
  public class AppWindowManager : MetroWindowManager
  {
      public override MetroWindow CreateCustomWindow(object view, bool windowIsView)
      {
          if (windowIsView)
          {
              return view as MainWindowContainer;
          }

          return new MainWindowContainer
          {
            Content = view
          };
      }
  }

Autofac Bootstrapper Setup Demo application

//Autofac AppBootstrapper
public class AppBootstrapper : CaliburnMetroAutofacBootstrapper<AppViewModel>
{
    protected override void ConfigureContainer(ContainerBuilder builder)
    {
        builder.RegisterType<AppWindowManager>().As<IWindowManager>().SingleInstance();
        var assembly = typeof(AppViewModel).Assembly;
        builder.RegisterAssemblyTypes(assembly)
            .Where(item => item.Name.EndsWith("ViewModel") && item.IsAbstract == false)
            .AsSelf()
            .SingleInstance();
    }
}

//AppWindowManager with custom Main window
public class AppWindowManager : MetroWindowManager
{
    public override MetroWindow CreateCustomWindow(object view, bool windowIsView)
    {
        if (windowIsView)
        {
            return view as MainWindowContainer;
        }
        return new MainWindowContainer
        {
            Content = view
        };
    }
}

License

Code and documentation are available according to the Unlicense (see LICENSE).