Hi,
I'm Using Composite Application Architecture for my application. I want to add Ribbon Tab Item from my loosely couple modules. In modules I can have only User Controls. I want to know how I can add user control for ribbon tab collection as a Ribbon Tab Item.
Hi Donavan,
you have to register the RegionAdapter with the CAL infrastructure in the bootstrapper as described by Alex.
protected override RegionAdapterMappings ConfigureRegionAdapterMappings() { var mappings = base.ConfigureRegionAdapterMappings(); mappings.RegisterMapping(typeof(TabGroupPane), Container.Resolve<TabGroupPaneRegionAdapter>()); mappings.RegisterMapping(typeof(XamRibbon), Container.Resolve<XamRibbonRegionAdapter>()); mappings.RegisterMapping(typeof(RibbonTabItem), Container.Resolve<RibbonTabItemRegionAdapter>()); return mappings; }
Than you have to register your region with the region manager. This can be done in XAML
<igRibbon:RibbonTabItem Header="Home" cal:RegionManager.RegionName="{x:Static inf:RegionNames.ShellRibbonHome}">
or you attach the RegionManager.RegionName dependency property in code.
You must derive your view from RibbonTabItem (not UserControl)
public class RibbonTabCaseManagementView : RibbonTabItem, IRibbonTabCaseManagementView { ...}
and than you can add it to the region:
_regionManager.AddToRegion(RegionNames.ShellRibbonHome, _container.Resolve<IRibbonTabCaseManagementPresenter>().View);
If you have the Adapter from Alex + mine you can add tabs to the ribbon, by giving the whole ribbon a region-name and adding items to a tab by giving the tab a region-name.
Hope that helps
Markus
Donavan,
I've answered your question in this forum thread.
Hi Markus, I've implemented your RegionAdapter for the RIbbonTab, but I'm a little confused on how my XAML should look. Do I register the entire ribbon control tab as the region? Can you provide a sample of your XAML markup?
Thanks in advance,
Donavan
Hi Andrew,
I have written a CAL RegionAdapter for the RibbonTab.
It's pretty straight forward, except that you must prevent the collection from sending events.
If you don't do so, you get ugly ArgumentOutOfRange exceptions.
I have attached the code.
Sincerely,
Perhaps another customer who has tried to use CAL with their own adapter for XamRibbon can chime in here. You might also want to check with the CAL/Prism group in case there is some support in CAL itself to obtain metadata from the view or perhaps define your own custom interface that the view must implement that provides some details about how to host the view.