Prism Adapters

  • 3 min to read

The DevExpress.Xpf.PrismAdapters.v19.2 assembly provides Prism 5 and Prism 6/7 adapters for the following controls:

The adapter instances are retrieved via the static AdapterFactory.Make method.

The code snippets below illustrate how to register the DevExpress Prism adapters in a Prism Unity bootstrapper.

Prism 5/6

class PrismBootstrapper : MefBootstrapper {
    protected override RegionAdapterMappings ConfigureRegionAdapterMappings() {
        var mappings = base.ConfigureRegionAdapterMappings();
        var factory = Container.GetExportedValue<IRegionBehaviorFactory>();
        mappings.RegisterMapping(typeof(DXTabControl),
            DevExpress.Xpf.Prism.AdapterFactory.Make<RegionAdapterBase<DXTabControl>>(factory));
        return mappings;
    }
    // ...
}

Prism 6

using Autofac;
class PrismBootstrapper : AutofacBootstrapper {
    protected override RegionAdapterMappings ConfigureRegionAdapterMappings() {
        var mappings = base.ConfigureRegionAdapterMappings();
        var factory = Container.Resolve<IRegionBehaviorFactory>();
        mappings.RegisterMapping(typeof(DXTabControl),
            DevExpress.Xpf.Prism.AdapterFactory.Make<RegionAdapterBase<DXTabControl>>(factory));
        return mappings;
    }
    // ...
}

Due to the Prism's limitation in handling adapters for FrameworkContentElement descendants (specifically NavBarGroup and NavigationFrame), region names need to be specified in XAML using the DXRegionManager class. See the following code snippet:

<UserControl ...
    xmlns:dxprism="http://schemas.devexpress.com/winfx/2008/xaml/prism">
    <dxn:NavBarControl>
        <dxn:NavBarGroup dxprism:DXRegionManager.RegionName="NavBarControlRegion" />
    </dxn:NavBarControl>
</UserControl>

The DXRegionManager attempts to get the currently used version of Prism based on the registered adapters and loaded assemblies if the value of the static DXRegionManager.PrismVersion property is not specified. It is recommended to set this property to the appropriate value manually.

Prism 7

public partial class App : PrismApplication {
    protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)     {
        base.ConfigureRegionAdapterMappings(regionAdapterMappings);
        var factory = Container.Resolve<IRegionBehaviorFactory>();
        regionAdapterMappings.RegisterMapping(typeof(DXTabControl), DevExpress.Xpf.Prism.AdapterFactory.Make<RegionAdapterBase<DXTabControl>>(factory));
    }
}

Examples

Prism - How to define Prism regions for various DXDocking elements

How to use the DXDocking and DXBars components with Prism

Using DXDocking for WPF in accordance with Composite Application Guidelines