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
Alex ,
I have implemented your RibbonRegionAdpater and added 3 tab items to the ribbon, but the ribbon is showing up with only one TabItem. Any suggestions ?
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
No worries I got it figured out.
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
Thanks for the quick response. I was just about to post that I figured it out. But thanks you guys rock