Nesting Prism Regions using RadRibbonBar

Thursday, September 02, 2010 by Miro Miroslavov | Comments 9

This post is update to my first post about "Decouple RadRibbonBar with Composite Silverlight (Prism)" (Read More). Nesting Regions in Prism could sound weird to someone, but the demand for this is growing. Check this forum post for more info.

As a result to this post I've decided to update my previous example project. I've started by marking the one of the RibbonTabs as a Region as well, giving it a name SalesTab.

<telerikRibbonBar:RadRibbonTab xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="CustomersRibbonTab.Ribbon"
        xmlns:telerikRibbonBar="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar"
        Header="Sales"
        xmlns:Regions="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation"
        Regions:RegionManager.RegionName="SalesTab">
    <telerikRibbonBar:RadRibbonGroup Header="Sales">
        <telerikRibbonBar:RadRibbonButton Content="Add" />
        <telerikRibbonBar:RadRibbonButton Content="Remove" />
    </telerikRibbonBar:RadRibbonGroup>
</telerikRibbonBar:RadRibbonTab>

After that I've added a new project similar to the other Modul projects, but the main view will be of base type - RadRibbonGroup:

<telerikRibbonBar:RadRibbonGroup xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SalesGroup.Group"
        xmlns:telerikRibbonBar="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar"
        Header="Dynamic Sales">
    <telerikRibbonBar:RadRibbonButton Content="First" />
    <telerikRibbonBar:RadRibbonButton Content="Prev" />
    <telerikRibbonBar:RadRibbonButton Content="Next" />
    <telerikRibbonBar:RadRibbonButton Content="Last" />
</telerikRibbonBar:RadRibbonGroup>

 And Finally add the new GroupModule to the bootstraper 's Module catalog.

ModuleCatalog catalog = new ModuleCatalog()
.AddModule(typeof(CustomersRibbonTab.CustomersRibbonTabModule))
.AddModule(typeof(SalesRibbonTab.SalesRibbonTabModule))
.AddModule(typeof(SalesGroup.SalesGroupModule));

As a result I get nested Prism Regions, where the main region has two Tabs and the nested Region tab has one static Group and one Dynamic.

  

I've also updated the project's referenced assemblies to the latest Prism and Telerik binaries. Also migrated the project to Visual Studio 2010 using Silverlight 4.

Download the code - RadRibbonBarPrism.zip

All comments and feedback are more than welcomed.

9 Comments

  • Runi Thomsen 29 Sep 2010

    Great that you can use a RibbonGroup as a region.  I have been trying to use a RadRibbonContextualGroupContainer as a PRISM Region using the same procedure you are describing, but with no luck.

    It would be great if the “search module” could add a context menu that relates to the module by adding a tab to a contextualGroupContainer.

    Do you know if my use case is supported?

  • Sarmaad 20 Apr 2011
    I am trying to do the same.. "navigating" a contextual group tab.

    Any feedback regarding this, would be much appreciated.
  • Tim Kelley 18 Jul 2011
    I'm trying to use this example with the RadMenu. Is this possible?
  • Tim Kelley 18 Jul 2011
    I'm trying to use this example with the RadMenu. Is this possible?
  • Tim Kelley 18 Jul 2011
    I'm trying to use this example with the RadMenu. Is this possible?
  • Ben Rocket 28 Jul 2011
    Thanks for sharing!
    I'd like to have the RadRibbonBar control in a distinct module instead of directly in the shell.  Works fine but if I inject a RadRibbonTab, turns out it's not selected.  I need to click on the tab header to see the content of it...  Any idea why it's happening?  
  • Ben Rocket 28 Jul 2011
    Thanks for sharing!
    I'd like to have the RadRibbonBar control in a distinct module instead of directly in the shell.  Works fine but if I inject a RadRibbonTab, turns out it's not selected.  I need to click on the tab header to see the content of it...  Any idea why it's happening?  
  • Ben Rocket 28 Jul 2011
    Thanks for sharing!
    I'd like to have the RadRibbonBar control in a distinct module instead of directly in the shell.  Works fine but if I inject a RadRibbonTab, turns out it's not selected.  I need to click on the tab header to see the content of it...  Any idea why it's happening?  
  • Tim Kelley 06 Aug 2011
    I'm still trying this with the RadMenu.  The view I'm injecting into the RadMenu contained in the shell is the following code. The view get's injected but the RadMenuItem looks like it wants to display horizontal and when you click on it it throws a Visual Studio exception.
    I'm dong exactly what was done in this example but it blows up! Help!
    <telerik:RadMenuItem Header="File">
                        <telerik:RadMenuItem Name="NewWedding" Header="New" />
                        <telerik:RadMenuItem Name="OpenWedding" Header="Open" />
                        <telerik:RadMenuItem IsSeparator="True" />
                        <telerik:RadMenuItem Name="ExportWedding" Header="Export..." />
                        <telerik:RadMenuItem Name="ImportWedding" Header="Import..." />
                        <telerik:RadMenuItem IsSeparator="True" />
                        <telerik:RadMenuItem Name="WeddingInformation" Header="Wedding Information" />
                        <telerik:RadMenuItem IsSeparator="True" />
                        <telerik:RadMenuItem Name="ExitProgram" Header="Exit" />
                    </telerik:RadMenuItem>

Add comment

  1. Formatting options
       
     
     
     
     
       
  2. (optional, emails won't be shown on public pages)
  3. (optional)