There are several configuration options while using WPF RCP platform.
You may change:
  • docking style type
  • logging framework
  • menu type

Docking types

There are two types of docking panels in RCP: If you use the application as shown in Quick start, the classical docking type will be used. This is because of the line in RegisterViews() method in BootstrapperBase class:

Container.Register<IShell, Shell>(LifetimePolicy.Singleton);

When you want to switch to Avalon Dock docking style the only thing you should do is using the follwing line in your application bootstraper _RegisterViews()> method:

Container.Register<IShell, AvalonDockControls.Views.AvalonDockShell>(LifetimePolicy.Singleton);

Changing implementation of the IShell interface (along with proper ViewModel) will also work if you want to use your own shell layout.

Platform is using 1.3 version of Avalon Dock project, which is included in the library folder.

Logging configuration

Platform is configured to work with two types of logging frameworks:
  • using Enterprise Library
  • log4Net
User is allowed to introduce any other framework by implementing interfaces:
  • ILogEntry which agregates properties for logger entry and is used by LoggerManager and to be shown in the UI
  • ILoggerService that actually performs log action
  • ILoggerView which is control interface that will be shown in the UI and need to be adjusted to the specific ILogEntry and have LoggerViewPresentationModel as ViewModel
Default platform configuration uses Enterprise Library. To switch it to log4Net you should use the following code in your application bootstraper _RegisterViews()> method:

log4net.Config.XmlConfigurator.Configure();
log4net.Config.BasicConfigurator.Configure(Container.Resolve<LogManagerAppender>());
Container.Register<ILoggerService, Log4NetLoggerService>(LifetimePolicy.Singleton);
Container.Register<WpfRcp.Views.ILoggerView, Log4NetLoggerView>(LifetimePolicy.Singleton);

Menu types

WPF RCP platform supports two types of menu:
  • standard based on hovered menu items
  • ribbon menu

Default configuration shows standard menu. This is because of the lines in BootstrapperBase class and RegisterViews() and RegisterServices() methods:

Container.Register<IMenuControl, MenuControl>(LifetimePolicy.Singleton);
Container.Register<IMenuItemFactory, MenuItemBasedMenuItemFactory>(LifetimePolicy.Singleton);

To switch the view to ribbon menu you should use the following code in your application bootstraper _RegisterViews()> method:

Container.Register<IMenuControl, RibbonMenuControl>(LifetimePolicy.Singleton);
Container.Register<IMenuItemFactory, RibbonBasedMenuItemFactory>(LifetimePolicy.Singleton);

You should also add the following method:

protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)
{
            base.ConfigureRegionAdapterMappings(regionAdapterMappings);

            regionAdapterMappings.RegisterMapping(typeof(RibbonButton),
                Container.Resolve<RibbonButtonRegionAdapter>());
}

Last edited Jul 12, 2013 at 11:32 AM by coldfusion, version 4

Comments

No comments yet.