Hi all,
Still there is no region adapter for the Ribbon control in NCAL... It has not been updated for awhile...
My question is what do you use for navigation if you develop using Prism. It looks like in this case you skip the Ribbon (unless you wrote your own region adapter for it) and resort to using basic WPF controls for navigation.
What are your approaches/solutions?
-g8r
Hello,
Do you have the the solution for the Ribbon Region Adapter? If you do , can you send me an simple example code ?
Thank you very much!
Please find the attached file with a sample implementation of a region adapter for the XamRibbon.
Alex,
Thanks for posting this solution. I have run into a little problem with it though. It seems that in this line of code that there is not a count property for the ContextualTabGroups. I am using version WPF4 2010.3 of the controls.
this
.xamRibbonRegionTarget.ContextualTabGroups.Count > 0
No worries I got it figured out.
Sorry for reviving this old thread, but I can't get this to work at all. Does anyone have a small, working sample project that uses the adapters discussed here? I first wrote a detailed post with all the details of what I'm doing, but I accidentally hit the mouse's "back" button and lost everything... :(
I'm getting cast errors in the RibbonTabItemRegionAdapter, and quite frankly I'm not sure what the adapter attached in this thread is supposed to adapt, but I haven't had any luck getting any of this to work.
I'm using MEF, not Unity. I had to add Export and ImportingConstructor attributes in the adapters, and I'm registering the view like this:
_region.RegionManager.RegisterViewWithRegion("TestContextualTab", () => new TestRibbonTab());
also tried:
_region.RegionManager.RegisterViewWithRegion("TestContextualTab", () => new TestRibbonTab().RibbonGroups);
Both result in a cast error in RibbonTabItemRegionAdapter. I tried without it, and the other adapter complains with:
An exception occurred while creating a region with name 'TestContextualTab'. The exception was: System.InvalidOperationException: ContentControl's Content property is not empty. This control is being associated with a region, but the control is already bound to something else. If you did not explicitly set the control's Content property, this exception may be caused by a change in the value of the inherited RegionManager attached property.
My view inherits from RibbonTabItem and defines a single RibbonGroup with a test button (ButtonTool) in it:
<igRibbon:RibbonTabItem x:Class="Views.TestRibbonTab" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:igRibbon="http://infragistics.com/Ribbon" Header="TestContext"> <igRibbon:RibbonGroup Caption="Test"> <igRibbon:ButtonTool Caption="Test Button" /> </igRibbon:RibbonGroup></igRibbon:RibbonTabItem>
Adapter mappings:
regionAdapterMappings.RegisterMapping(typeof(XamRibbon), Container.GetExportedValue<XamRibbonRegionAdapter>());regionAdapterMappings.RegisterMapping(typeof(RibbonTabItem), Container.GetExportedValue<RibbonTabItemRegionAdapter>());
Ultimately what I want to do if for modules to "inject" their view into a contextual tab so that module-specific tabs are visible only when the module is being displayed.
Any idea / more info you need to help?
Thanks,Michel