DevExpress BarManager with Prism

Topics: Prism v4 - WPF 4
Oct 12, 2010 at 7:20 PM


I'm writing an application using DevExpress controls and Prism. I have a BarManager in the shell with the main menu bar and marked this bar as a region.

<dxb:BarManager Name="barManager">
        <dxb:Bar Caption="Main" IsMainMenu="True" UseWholeRow="True" cal:RegionManager.RegionName="{x:Static infrastructure:RegionNames.MainMenuBar}">


If I run this without a custom region adapter, I get an exception "No region adapter for region MainMenuBar found". So I created a custom region and register the region mapping.

    protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
        RegionAdapterMappings mappings = base.ConfigureRegionAdapterMappings();
        mappings.RegisterMapping(typeof(Bar), this.Container.Resolve<MenuBarAdapter>());

        return mappings;

Fine, it runs without exception, but the region does not get registered. So what is wrong?

Thanks for help, Enyra

Oct 13, 2010 at 10:01 PM


Based on my understanding, you created your custom region adapter, but views are not displayed in your region. I am not aware how the DevExpress controls work. So if you continue experiencing this problem, could you please share the region adapter implementation or any other relevant information?

Fernando Antivero

Oct 15, 2010 at 10:49 PM

Hello fantivero

No not only the view is not display, but the region is not in the regions list of the region manager at all. I'm curious, because the "CreateRegion" and "Adapt" methods of the adapter get called. Here is my adapter. 

	public class BarRegionAdapter : RegionAdapterBase<Bar>
		public BarRegionAdapter(IRegionBehaviorFactory behaviorFactory)
			: base(behaviorFactory)

		protected override void Adapt(IRegion region, Bar regionTarget)
			if (region == null)
				throw new ArgumentNullException("region");

			if (regionTarget == null)
				throw new ArgumentNullException("regionTarget");

			region.Views.CollectionChanged += (sender, e) =>
				if (e.Action == NotifyCollectionChangedAction.Add)
					IEnumerable<BarItem> newBars = e.NewItems.OfType<BarItem>();
					foreach (BarItem barItem in newBars)

		protected override IRegion CreateRegion()
			return new AllActiveRegion();

If a declare the BarManager as a region it works and I can add menus. Perhaps it has something to do with the xaml tree structure of the BarManager?

Thanks for help,


Oct 22, 2010 at 3:26 PM

Hi Enyra,

First of all, I realized that your Adapt method is different to the ItemsControlRegionAdapter class. Have you found that this implementation is not appropriate in your scenario?

On the other hand, it is strange that you could not found the region in the Region Manager. But as you mentioned, it might be related with this BarManager control. So i think that you can find interesting the following forum thread: Region in adorner (Fluent Ribbon Backstage)

If you has not solved this, could you please share a repro sample?

Fernando Antivero