Prism Region in Backstage

Aug 6, 2010 at 12:31 PM
I'm using CAL (also known as CompositeWPF or patterns & practices: Prims; http://compositewpf.codeplex.com/) and want to place a Region in the Fluent Ribbon Backstage.

<fluent:RibbonWindow x:Class="Shell" ....>
<fluent:Ribbon ...>
<fluent:Ribbon.BackstageItems>
<fluent:Ribbon.BackstageTabItem ...>
<ContentControl cal:RegionManager:RegionName="MyRegionName" />
</fluent:Ribbon.BackstageTabItem>
</fluent:Ribbon.BackstageItems>
</fluent:Ribbon>
</fluent:RibbonWindow>

Unfortunately, this doesn't work. As far as I know the reason is the following: In CAL, the RegionManager is attached to the Shell/RibbonWindow, and the RegionName attached property searches for that attached region manager in the logical tree parents of the ContentControl. But in Fluent the Backstage items are not in the same logical tree as the RibbonWindow - they are in an adorner which starts a completly unconnected logical tree.

To solve this I think I would have to attach the region manager manually to a parent of the backstage items (this does not seem to be possible in fluent, as the backstage and backstageButton are private and the BackstageItems is not a DependencyProperty) or even to each BackstageTabItem (which kind of defeats the purpose of using CAL in the first place.)

Does anyone have a better idea?

Thanks!
Aug 16, 2010 at 11:30 AM
Could maybe a public Backstage getter property be added to the Ribbon?
Coordinator
Aug 16, 2010 at 1:46 PM

Yes, it will in v2

Apr 6, 2011 at 4:43 PM

I too want to achieve this but have no idea how to. Since v2 is out can you share with us how you would do this? I want to load the backstageitems into the region from another Prisim module.

Apr 12, 2011 at 8:30 AM

Thankfullly, in v2 I think no tricks are needed anymore to make the RegionManager work in the backstage. I'm simply doing this now:

 

<r:Ribbon>
   <r:Ribbon.Menu>
       <r:Backstage>
         <r:BackstageTabControl>
            <r:BackstageTabItem Header="Title of tab for module 1">
               <ContentControl prism:RegionManager.RegionName="Module1" />
            </r:BackstageTabItem>
            <r:BackstageTabItem Header="Title of tab for module 2">
               <ContentControl prism:RegionManager.RegionName="Module1" />
            </r:BackstageTabItem>
         </r:BackstageTabControl>
       </r:Backstage>
   </r:Ribbon.Menu>
</r:Ribbon>

 

(I currently have a known fixed number of modules with one backstage tab each, so I define these in the Shell. If you need a dynamic number of items you might have to write and register a Prism RegionAdapter...)

Hope this helps.