RibbonTab in Prism Region with MEF Module

Topics: Prism v4 - WPF 4
Oct 11, 2010 at 4:31 PM

When I try to import RibbonTab with MEF Module to the MenuRegion in the Shell, I get an exception like "Index out of range exception", this is Prism v4 or Ribbon problem?

Oct 11, 2010 at 11:01 PM

did you write a region adapter for Prism?

Oct 12, 2010 at 8:58 AM

Yesterday night I have solved the problem of region adapter, and now I can add RibbonTab.

But now I can't add a RibbonGroup to the Shell in xaml code defined RibbonTab "Home", because the RegionManager don't contain the region "HomeTabRegion" associated to the RibbonTab "Home" ... before RegionAdapter, MEF/PRISM Importing RibbonGroup to the HomeTabRegion works well ... I'll try to do some debugging test, but if you have any idea is well accepted.

Oct 12, 2010 at 2:02 PM

can you show how you are declaring the region?

Oct 12, 2010 at 8:15 PM

Shell partial XAML
<r:Ribbon x:Name="Ribbon" prism:RegionManager.RegionName="{x:Static region:RegionNames.MenuRegion}">
      <r:RibbonTab x:Name="HomeTab" Header="Home" prism:RegionManager.RegionName="{x:Static region:RegionNames.HomeRegion}"/>

Module with RibbonGroup

public void Initialize()

      _regionManager.AddToRegion(RegionNames.HomeRegion, new ModuleMenuView ());



This RegionManager does not contain a Region with the name 'HomeRegion'.
Parameter name: regionName

Oct 12, 2010 at 10:03 PM

now that I can see what you are doing... Unless you coded into your regionadapter how to handle RibbonTabs then it will always throw an error for that, since the regionmanager doesn't know how to map a RibbonTab (yet).

I would so say that there was a support ticket into P&P for regionadapters for the ribbon control, patience or make your region adapter work with everything associated with the Ribbon.

It's old but it might have some useful information for creating the adapter to work with everything.





Oct 13, 2010 at 2:49 PM

Sorry I forgot to write that I already have a regionAdapter, similar to that of the link, the difference lies in the use of Items instead of Tabs to the Ribbon, and there is no "region.activeviews.tolist (). ForEach (x = > ribbon.tabs.add (x as the RibbonTab));"
I tried to use the copy of the one in the link, changing only Tabs into Items, but the problem persists