views:

1468

answers:

2

Hi.

Does anyone have sample code on how to create a Region Adapter for AvalonDock's DocumentPane and DockingPane?

A: 

My advice would be to look in Microsoft.Practices.Composite.Presentation.Regions in the Prism source. Specifically, take a look at the ItemsControlRegionAdapter and use it as a template. Remember to inherit from RegionAdapterBase<>:

public class ItemsControlRegionAdapter : RegionAdapterBase<ItemsControl>

and to override ConfigureRegionAdapterMappings() in the bootstrapper. That would look something like:

protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
{
    RegionAdapterMappings mappings =  base.ConfigureRegionAdapterMappings();
    mappings.RegisterMapping(typeof(Canvas), Container.Resolve<CanvasRegionAdapter>());
    return mappings;
}
Erik Mork
+1  A: 

The Markus Raufer has added two region adapters to the CompositeWpfContrib project at CodePlex that supports both DocumentPane and DockingPane.

Manga Lee

related questions