Telerik blogs

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.


About the Author

Miroslav Miroslavov

is XAML enthusiast. You can follow him on Twitter at @mmiroslavov.

 

Comments

Comments are disabled in preview mode.