Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > RibbonBar > RadRibbonBar as PRISM Region

Answered RadRibbonBar as PRISM Region

Feed from this thread
  • stuart armstrong avatar

    Posted on Mar 24, 2010 (permalink)

    Hi,

    Is it possible to add the RadRibbonBar as PRISM Region?? I have tried to do it using the following post as an example
    http://www.telerik.com/community/forums/silverlight/tabcontrol/tab-control-and-prism.aspx.

    I have created a region adapter and I am now trying to add a basic RadRibbonTab to the RadRibbonBar region. <ribbon:RadRibbonTab Header="Page Layout"/> however it's not working and there are no error messages.

    Any help would be greatly appreciated.

     

    Reply

  • Miro Miroslavov Miro Miroslavov admin's avatar

    Posted on Mar 25, 2010 (permalink)

    Hi stuart armstrong,

    Please find the attached example project with RadRibbonBar placed in a PRISM module. (You'll need to fix the referenced dlls)
    We hope it'll work for you.

    All the best,
    Miro Miroslavov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Attached files

    Reply

  • Jeff Lishingman avatar

    Posted on Mar 25, 2010 (permalink)

    Thanks for the reply however its not quite what I was looking for. I would like to add

    <ribbon:RadRibbonBar Regions:RegionManager.RegionName="ribbonRegion" />
      
    Then use PRIM to inject x number of RadRibbonTab controls e.g.

    <ribbon:RadRibbonTab Header="Dashboard" />
    <ribbon:RadRibbonTab Header="Admin" />

    To create something like this....

    <ribbon:RadRibbonBar Regions:RegionManager.RegionName="ribbonRegion" />
        <ribbon:RadRibbonTab Header="Dashboard" />
        <ribbon:RadRibbonTab Header="Admin" />

    </radRibbonBar/>




    Reply

  • stuart armstrong avatar

    Posted on Mar 25, 2010 (permalink)

    Sorry the post above is mine but I was logged in with a different account.

    Reply

  • Answer Miro Miroslavov Miro Miroslavov admin's avatar

    Posted on Mar 26, 2010 (permalink)

    Hello stuart armstrong,

    Can you please read this blog post. It's about your request. You can download the demo project at the end of the post.
    Hope will help you.

    Kind regards,
    Miro Miroslavov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

    Reply

  • stuart armstrong avatar

    Posted on Mar 26, 2010 (permalink)

    Thank you Miro that's exactly what I was looking for.

    Reply

  • Andrew Thompson avatar

    Posted on Apr 3, 2010 (permalink)

    Great blog post, was just googling for "RadRibbonBar Prism Regions" now :-)

    Reply

  • Andrew Thompson avatar

    Posted on Apr 3, 2010 (permalink)

    Ok, I have a question - given the HelloWorld.Silverlight (RadRibbon/Prism) example on that blog post, can I now create other modules that can add RadRibbonGroups onto existing RadRibbonTabs (assuming the tab has been created)?

    For instance, the example creates a SalesRibbonTab and a CustomersRibbonTab. Each one has a single RadRibbonGroup called "Sales" and "Customers". 

    What if I or a third party wanted to make a "ExtendedSalesModule" which had other sales operations, and wanted to place a RadRibbonGroup called "More Sales" onto the existing sales tab?

    Make sense?! Perhaps this dodgy diagram will help! :)

    The scenario I have is I am working on feasibility for an application that must be extendible by third parties. The app will use Prism and I want to see if I can allow third parties full control over addition ribbon controls & docking manager controls also. 


    Attached files

    Reply

  • Andrew Thompson avatar

    Posted on Apr 3, 2010 (permalink)

    Actually, I worked it out lol

    Here - I modified the SalesRibbonTab Ribbon.xaml file as follows:

    <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:cal="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation" 
            cal:RegionManager.RegionName="SalesRibbonTabRegion"
        <telerikRibbonBar:RadRibbonGroup Header="Sales"
            <telerikRibbonBar:RadRibbonButton Content="Add" /> 
            <telerikRibbonBar:RadRibbonButton Content="Remove" /> 
        </telerikRibbonBar:RadRibbonGroup> 
    </telerikRibbonBar:RadRibbonTab> 
     


    Then added a new Silverlight UserControl but changing the inherited class to RadRibbonGroup. Finally I injected to the RegionManager as before. 

    <telerikRibbonBar:RadRibbonGroup x:Class="CustomersRibbonTab.RibbonGroupTest" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
        xmlns:telerikRibbonBar="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar" 
        Header="MoreSales"
     
        <telerikRibbonBar:RadRibbonGroup.Items> 
            <telerikRibbonBar:RadRibbonButton Content="Test3" /> 
            <telerikRibbonBar:RadRibbonButton Content="Test4" /> 
        </telerikRibbonBar:RadRibbonGroup.Items>     
         
    </telerikRibbonBar:RadRibbonGroup> 

    regionManager.RegisterViewWithRegion("SalesRibbonTabRegion"typeof(RibbonGroupTest)); 

    As far as I'm concerned, this is great! However, the only problem is I can't see the ribbon controls I'm creating in the designer.

    Reply

  • Garry Clark Master avatar

    Posted on Jun 4, 2010 (permalink)

    Andrew,
    I'm playing with the exact same concept, however in your solution it looks and sounds to me like you will have to define all your tabs at design time. My situation is that I would like to have one or two predefined tabs such as Home and Settings, but still be able to have my modules add tabs as needed

    I have it where my modules can add tabs to the RibbonBar because the RibbonBar is a region, however since you can not nest regions in Prism there is no way to have regions also setup on my tabs.

    Do you have a solution for my scenario or am I correct and you define your tabs at design time making each a region and thus not making the RibbonBar a region?

    If that is the case does anyone have any suggestions on how to merge RadRibbonGroups into predfined tabs if they are not regions?

    If I am not clear on what I am asking I can easily throw some code out here.

    Thanks!

    Reply

  • jgill Intermediate avatar

    Posted on Aug 28, 2010 (permalink)

    Hi,
    I am facing the same issue as Gary.  Is there a way to have nested Prism regions using the RadRibbon control?  For example to have both the RadRibbon and RadRibbon tabs be Prism regions.

    More concrete example:  Imagine you create a base module that creates a tab called Reporting with set groups and menu items, but you also want to allow other people to add new groups of menu items within that tab without directly modifying the original module.

    Reply

  • Miro Miroslavov Miro Miroslavov admin's avatar

    Posted on Sep 2, 2010 (permalink)

    Hello jgill, Andrew and Garry,

    I've created a little blog post with attached example project, demonstrating Nesting Prism regions with RadRibbonBar, where the one of the tabs is used as a Region as well.
    It will be great if you can take a look on it and let me know if this is what you need and expect.
    Read more.
    If you have other ideas, or better suggestions - We can work together to make the example more robust and straight to your needs.
    Thank you.

    Greetings,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Garry Clark Master avatar

    Posted on Sep 2, 2010 (permalink)

    Miro,
    I look forward to looking at your solution. I will try to do so sometime this week and get you some feedback.

    What I ended up doing for my solution was to implement a factory that each module who needed to add controls to the ribbon could use. It was not the most graceful solution, but it works fairly well.

    The gist is that each module has a global RadRibbon tab that gets added to the RibbonRegion defined in the shell. Each viewmodel either creates it's own group for adding its controls or they can all use the same group which ever is needed. When the ViewModel Initializes it creates a RibbonItem, RadRibbonButtons for the most part, and adds them to a group passing an ICommand object and some other parameters.

    Like I said not the most graceful solution, but I had to do something. :) Below are snippets from my code that makes this all work.

    ModuleController
    private static RadRibbonTab ribbonTab = RibbonBarFactory.CreateRibbonTab(Properties.Resources.ModuleTitle);
            public static RadRibbonTab ModuleTab
            {
                get { return ribbonTab; }
                set { ribbonTab = value; }
            }
      
            private void AddRibbonGroups()
            {
                ////create ribbon group to add to tab
                CreateRibbonGroups();
      
                //Add Tab to RibbonBarRegion
                regionManager.Regions[RegionNames.RibbonBarRegion].Add(ribbonTab);
            }
      
            private void CreateRibbonGroups()
            {
                RibbonBarFactory.AddRibbonGroup(ribbonTab, RibbonBarFactory.CreateRibbonGroup(Properties.Resources.ManageSecurity));
                RibbonBarFactory.AddRibbonGroup(ribbonTab, RibbonBarFactory.CreateRibbonGroup(Properties.Resources.ManageRules));
            }

    ViewModel Registering RibbonItems
    private void AddToolbarItems()
            {
                if (ModuleController.ModuleTab != null)
                {
                    RibbonBarFactory.CreateRadButton(Properties.Resources.ManageUsers, ResourceService.GetPackUri("Resources/Users.png"), LaunchCommand, RibbonBarFactory.GetGroupByIndex(ModuleController.ModuleTab,0));
                }
            }

    Like I said this actually works really well. Some of the draw backs though are that each module gets its own tab. There is no way to use a tab that another module has registered because they of course are disconnected from one another. I guess I could probably create a global container that would allow each module to register its tab or use one already registered in the collection, but I would really have to look and think about that. 

    Anyhow this is my make shift solution, but I am hoping yours is much more elegant.

    Thanks Miro!  

    Reply

  • Miro Miroslavov Miro Miroslavov admin's avatar

    Posted on Sep 8, 2010 (permalink)

    Hi Garry Clark,

    My example is really simple - I don't even use MVVM, but the simplest way of nesting predefined regions. 
    On a side note, do you really need to invert the idea of MVVM, meaning that the ViewModel "creates" it's own groups? Actually it is kind of logical in this situation, but kind of contrast with the ViewModel "that do not know about the View".
    Anyway thank you for sharing your idea, hope the other guys will also benefit from it.

    Best wishes,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Garry Clark Master avatar

    Posted on Sep 8, 2010 (permalink)

    Miro,
    I am not sure what you mean by invert MVVM. My viewmodel knows nothing about the view still. It is completely decoupled from it. The only thing the view models know about is a public RadRibbonTab in the ModuleController class which is defined for each module not globally.  The RadRibbonTab gets registered with a region defined in the Shell not the view.

    With my solution I could completely swap out the view for another one and the RadRibbon would continue to function as is. Am I missing something though?

    Thanks,
    Garry

    Reply

  • Miro Miroslavov Miro Miroslavov admin's avatar

    Posted on Sep 13, 2010 (permalink)

    Hi Garry Clark,

    Now I get your point. However what I meant was that in the usual MVVM - the View is created from the ViewModel (using Data Binding). The way you do it is also decoupled and correct. 
    Sorry for my misunderstanding.  :)

    Greetings,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Garry Clark Master avatar

    Posted on Sep 13, 2010 (permalink)

    Miro,
    No problem, but I will have to say that after looking at your solution I have gone back and reworked mine. For whatever reason it never dawned on me to create a RadRibbonTab view and add it to the RibbonBarRegion. I basically took what you had and what I had and combined them and have a solution I am much happier with. Only thing that doesn't really work that would be nice is design time support for a RadRibbonTab, but this is easy enough to work around. I simply create a test window create my RadRibbonBar there and once I have my tabs and groups looking the way I want I simply copy and paste.

    Also I have not tried to combine tabs or add items from one module to a global Home or Settings Tab, but I really haven't had the need yet either. So in other words with this new solution I still have one tab for each module.

    Here is a snippet from one of my modules.

    View
    <telerikRibbonBar:RadRibbonTab x:Class="EliteExtender.Security.Views.RibbonTabView"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 xmlns:telerikRibbonBar="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar"
                 xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
                 mc:Ignorable="d" 
                 d:DesignHeight="300" d:DesignWidth="300" Header="{Binding TabHeader}">
        <telerikRibbonBar:RadRibbonGroup Header="{Binding SecurityGroupHeader}">
            <telerikRibbonBar:RadRibbonButton Command="{Binding ManageUsersCommand}">
                <StackPanel Orientation="Vertical">
                    <Image Source="{Binding ManageUsersButtonIcon}" Margin="0,0,5,0" Width="24" Height="24"/>
                    <TextBlock Text="{Binding ManageUsersButtonText}"/>
                </StackPanel>
            </telerikRibbonBar:RadRibbonButton>
            <telerikRibbonBar:Separator/>
            <telerikRibbonBar:RadRibbonButton Command="{Binding ManageRolesCommand}">
                <StackPanel Orientation="Vertical">
                    <Image Source="{Binding ManageRolesButtonIcon}" Margin="0,0,5,0" Width="24" Height="24"/>
                    <TextBlock Text="{Binding ManageRolesButtonText}"/>
                </StackPanel>
            </telerikRibbonBar:RadRibbonButton>
            <telerikRibbonBar:Separator/>
            <telerikRibbonBar:RadRibbonButton Command="{Binding ManagePermissionsCommand}">
                <StackPanel Orientation="Vertical">
                    <Image Source="{Binding ManagePermissionsButtonIcon}" Margin="0,0,5,0" Width="24" Height="24"/>
                    <TextBlock Text="{Binding ManagePermissionsButtonText}"/>
                </StackPanel>
            </telerikRibbonBar:RadRibbonButton>
        </telerikRibbonBar:RadRibbonGroup>
        <telerikRibbonBar:RadRibbonGroup Header="{Binding RulesGroupHeader}">
            <telerikRibbonBar:RadRibbonButton Command="{Binding BuildRulesCommand}" Size="Large">
                <StackPanel Orientation="Vertical">
                    <Image Source="{Binding BuildRulesButtonIcon}" Margin="0,0,5,0" Width="24" Height="24"/>
                    <TextBlock Text="{Binding BuildRulesButtonText}" TextWrapping="Wrap"/>
                </StackPanel>
            </telerikRibbonBar:RadRibbonButton>
            <telerikRibbonBar:Separator/>
            <telerikRibbonBar:RadRibbonButton Command="{Binding CleanRulesCommand}" Size="Large">
                <StackPanel Orientation="Vertical">
                    <Image Source="{Binding CleanRulesButtonIcon}" Margin="0,0,5,0" Width="24" Height="24"/>
                    <TextBlock Text="{Binding CleanRulesButtonText}" TextWrapping="Wrap"/>
                </StackPanel>
            </telerikRibbonBar:RadRibbonButton>
        </telerikRibbonBar:RadRibbonGroup>
    </telerikRibbonBar:RadRibbonTab>

    ViewModel
    using System.ComponentModel;
    using System.Windows.Input;
    using System.Windows.Media.Imaging;
    using EliteExtender.Composite.Extensions;
    using EliteExtender.Composite.Extensions.ViewModels;
    using EliteExtender.Infrastructure.Security;
    using EliteExtender.Infrastructure.Services;
    using EliteExtender.Security.Properties;
    using EliteExtender.Security.Views;
    using EliteExtender.Synchronization.Database;
    using Microsoft.Practices.Composite.Events;
    using Microsoft.Practices.Composite.Regions;
    using Microsoft.Practices.Unity;
    using EliteExtender.Security.Domain;
      
    namespace EliteExtender.Security.ViewModels
    {
        internal class RibbonTabViewModel : ViewModelBase<IRibbonTabView>
        {
            private readonly IUnityContainer container;
            private readonly IEventAggregator aggregator;
            private readonly IRegionManager regionManager;
            private readonly EliteExtenderAuthorizationRuleProvider ruleProvider;
            DBSynchronization dbSync;
      
            private readonly DelegateCommand manageRolesCommand;
            private readonly DelegateCommand manageUsersCommand;
            private readonly DelegateCommand managePermissionsCommand;
            private readonly DelegateCommand buildRulesCommand;
            private readonly DelegateCommand cleanRulesCommand;
      
            ManageUsersViewModel presentationManageUsersModel;
            ManageRolesViewModel presentationManageRolesModel;
            ManagePermissionsViewModel presentationManagePermissionsModel;
      
            public RibbonTabViewModel(IUnityContainer container, IRibbonTabView view, IEventAggregator aggregator, DBSynchronization dbSync, EliteExtenderAuthorizationRuleProvider ruleProvider)
                : base(view)
            {
                this.container = container;
                this.aggregator = aggregator;
                this.dbSync = dbSync;
                this.ruleProvider = ruleProvider;
      
                //Subscribe to DBSync change events
                //dbSync.PropertyChanged += new PropertyChangedEventHandler(dbSync_PropertyChanged);
      
                //Commands
                this.manageRolesCommand = new DelegateCommand(OnManageRolesExecute, CanManageRolesExecute);
                this.manageUsersCommand = new DelegateCommand(OnManageUsersExecute, CanManageUsersExecute);
                this.managePermissionsCommand = new DelegateCommand(OnManagePermissionsExecute, CanManagePermissionsExecute);
                this.buildRulesCommand = new DelegateCommand(OnBuildRulesExecute, CanBuildRulesExecute);
                this.cleanRulesCommand = new DelegateCommand(OnCleanRulesExecute, CanCleanRulesExecute);
      
                //ViewModels
            }
      
            public string TabHeader
            {
                get { return Properties.Resources.ModuleTitle; }
            }
      
            public string SecurityGroupHeader
            {
                get { return Properties.Resources.ManageSecurity; }           
            }
      
            public string RulesGroupHeader
            {
                get { return Properties.Resources.ManageRules; }
            }
      
            public string ManageUsersButtonText
            {
                get { return Resources.ManageUsers; }
            }
      
            public BitmapImage ManageUsersButtonIcon
            {
                get
                {
                    return new BitmapImage(ResourceService.GetPackUri("Resources/Users.png"));
                }
            }
      
            public string ManageRolesButtonText
            {
                get { return Resources.ManageRoles; }
            }
      
            public BitmapImage ManageRolesButtonIcon
            {
                get
                {
                    return new BitmapImage(ResourceService.GetPackUri("Resources/Roles.png"));
                }
            }       
              
            public string ManagePermissionsButtonText
            {
                get { return Resources.ManageRoles; }
            }
      
            public BitmapImage ManagePermissionsButtonIcon
            {
                get
                {
                    return new BitmapImage(ResourceService.GetPackUri("Resources/Permissions.png"));
                }
            }
      
            public string BuildRulesButtonText
            {
                get { return Resources.BuildRules; }
            }
      
            public BitmapImage BuildRulesButtonIcon
            {
                get
                {
                    return new BitmapImage(ResourceService.GetPackUri("Resources/BuildRules.png"));
                }
            }
      
            public string CleanRulesButtonText
            {
                get { return Resources.CleanRules; }
            }
      
            public BitmapImage CleanRulesButtonIcon
            {
                get
                {
                    return new BitmapImage(ResourceService.GetPackUri("Resources/CleanRules.png"));
                }
            }
      
            public ICommand ManageRolesCommand { get { return manageRolesCommand; } }
            private bool CanManageRolesExecute()
            {
                return ruleProvider.Authorized(RuleList.ManageRoles);
            }
            private void OnManageRolesExecute()
            {
                if (presentationManageRolesModel == null)
                {
                    presentationManageRolesModel = container.Resolve<ManageRolesViewModel>();
                }
                presentationManageRolesModel.Launch();
            }
      
            public ICommand ManageUsersCommand { get { return manageUsersCommand; } }
            private bool CanManageUsersExecute()
            {
                return ruleProvider.Authorized(RuleList.ManageUsers);
            }
            private void OnManageUsersExecute()
            {
                if (presentationManageUsersModel == null)
                {
                    presentationManageUsersModel = container.Resolve<ManageUsersViewModel>();
                }
                presentationManageUsersModel.Launch();
            }
      
            public ICommand ManagePermissionsCommand { get { return managePermissionsCommand; } }
            private bool CanManagePermissionsExecute()
            {
                return ruleProvider.Authorized(RuleList.ManagePermissions);
            }
            private void OnManagePermissionsExecute()
            {
                if (presentationManagePermissionsModel == null)
                {
                    presentationManagePermissionsModel = container.Resolve<ManagePermissionsViewModel>();
                }
                presentationManagePermissionsModel.Launch();
            }
      
            public ICommand BuildRulesCommand { get { return buildRulesCommand; } }
            private bool CanBuildRulesExecute()
            {
                return ruleProvider.Authorized(RuleList.BuildRules);
            }
            private void OnBuildRulesExecute()
            {
                if (presentationManagePermissionsModel == null)
                {
                    presentationManagePermissionsModel = container.Resolve<ManagePermissionsViewModel>();
                }
                presentationManagePermissionsModel.BuildRules();
            }
      
            public ICommand CleanRulesCommand { get { return cleanRulesCommand; } }
            private bool CanCleanRulesExecute()
            {
                return ruleProvider.Authorized(RuleList.CleanRules);
            }
            private void OnCleanRulesExecute()
            {
                if (presentationManagePermissionsModel == null)
                {
                    presentationManagePermissionsModel = container.Resolve<ManagePermissionsViewModel>();
                }
                presentationManagePermissionsModel.CleanRules();
            }
        }
    }

    ModuleController (wireup code)
     
    using EliteExtender.Infrastructure;
    using EliteExtender.Infrastructure.Factories;
    using EliteExtender.Security.ViewModels;
    using EliteExtender.Security.Views;
    using Microsoft.Practices.Composite.Regions;
    using Microsoft.Practices.Composite.Modularity;
    using Microsoft.Practices.Unity;
    using Telerik.Windows.Controls;
    using System.Windows;
      
    namespace EliteExtender.Security.Domain
    {
        internal class ModuleController
        {
            private readonly IUnityContainer container;
            private readonly IRegionManager regionManager;
            private readonly IModuleCatalog moduleCatalog;
            private readonly IModuleManager moduleManager;
      
            #region PresentationModel
            private LoginBoxViewModel presentationLoginModel;
            private ManageUsersViewModel presentationManageUsersModel;
            private ManagePermissionsViewModel presentationPermissionsModel;
            private ManageRolesViewModel presentationManageRolesModel;
            private RibbonTabViewModel presentationRibbonTabModel;
            #endregion
      
            public ModuleController(IUnityContainer container, IRegionManager regionManager, IModuleCatalog moduleCatalog, IModuleManager moduleManager)
            {
                if (Application.Current != null)
                {
                    this.container = container;
                    this.regionManager = regionManager;
                    this.moduleCatalog = moduleCatalog;
                    this.moduleManager = moduleManager;
                }            
            }
      
            public void Initialize()
            {
                //Register the Login View so that we can get an IPrincipal
                RegisterLoginView();
                presentationLoginModel.Initialize();
                presentationLoginModel.Open();
                  
                //Register and activate these after the login process has completed
                LoadOnDemandModules();
                RegisterViewsandServices();
                RegisterViewModels();
            }
      
            /// <summary>
            /// This method is responsible for loading all modules who are not loaded until a user has been authenticated
            /// </summary>
            private void LoadOnDemandModules()
            {
                foreach (ModuleInfo module in moduleCatalog.Modules)
                {
                    if (module.InitializationMode == InitializationMode.OnDemand && module.State == ModuleState.NotStarted)
                    {
                        moduleManager.LoadModule(module.ModuleName);
                    }
                }
            }
              
            private void RegisterLoginView()
            {
                container.RegisterType<ILoginBoxView, LoginBoxView>(new ContainerControlledLifetimeManager());
      
                if (presentationLoginModel == null)
                {
                    presentationLoginModel = container.Resolve<LoginBoxViewModel>();
                }
            }
      
            private void RegisterViewsandServices()
            {
                container.RegisterType<IManagePermissionsView, ManagePermissionsView>(new ContainerControlledLifetimeManager());
                container.RegisterType<ICreateModifyRoleView, CreateModifyRoleView>(new ContainerControlledLifetimeManager());
                container.RegisterType<ICreateModifyUserView, CreateModifyUserView>(new ContainerControlledLifetimeManager());
                container.RegisterType<IManageUsersView, ManageUsersView>(new ContainerControlledLifetimeManager());
                container.RegisterType<IChangePermissionsView, ChangePermissionsView>(new ContainerControlledLifetimeManager());
                container.RegisterType<IManageRolesView, ManageRolesView>(new ContainerControlledLifetimeManager());
                container.RegisterType<IRibbonTabView, RibbonTabView>(new ContainerControlledLifetimeManager());
            }            
      
            private void RegisterViewModels()
            {
                 if (presentationManageUsersModel == null)
                {
                    presentationManageUsersModel = container.Resolve<ManageUsersViewModel>();
                   // presentationManageUsersModel.Initialize();
                }
      
                if (presentationManageRolesModel == null)
                {
                    presentationManageRolesModel = container.Resolve<ManageRolesViewModel>();
                    //presentationManageRolesModel.Initialize();
                }
      
                if (presentationPermissionsModel == null)
                {
                    presentationPermissionsModel = container.Resolve<ManagePermissionsViewModel>();
                }
      
                if (presentationRibbonTabModel == null)
                {
                    presentationRibbonTabModel = container.Resolve<RibbonTabViewModel>();
                    regionManager.Regions[RegionNames.RibbonBarRegion].Add(presentationRibbonTabModel.View);
                }
                regionManager.Regions[RegionNames.RibbonBarRegion].Activate(presentationRibbonTabModel.View);
            }
        }
    }

    Please let me know any comments you have on this soltuion. I really appreciate you sticking with this topic and working it through with us as I think it can benefit many Prism coders.

    Thanks!

    Reply

  • Miro Miroslavov Miro Miroslavov admin's avatar

    Posted on Sep 16, 2010 (permalink)

    Hi Garry Clark,

    I am really happy to hear that. I've also entirely read your code and liked it a lot - perfect example on mixing Prism and complicated MVVM. I'm sure that this combined solution will help other guys with developing applications with Prism. (I've updated your telerik points as a thanks).
    You are right about the design support - it could be more accurate and we will do it with our future releases.

    All the best,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Yann avatar

    Posted on Oct 31, 2010 (permalink)

    This solution works but what happens if my application has two themes that change the navigation in the shell?

    Let's say I have a RibbbonBarTheme that use a RibbonBar as application menu (like mspaint) and PanelBarTheme that change the menu to be a PanelBar (like a conventional web site).

    With this solution, all modules know that the shell uses a RibbonBar as application menu so if you change the shell, you must modify each module.

    I think Prism is designed to avoid this type of situation, no? Is it not better to create our own clr objects that will contains the information of the menu and use the adapter system of PRISM to generate all items of RibbonBar or other control used by the shell?

    Then we just need to create an adapter for each type of navigation, we decide to use in the shell and we don't have to change any module. We can even use this objects as a source of binding for the menu it
    This solution works but what happens if my application has two themes that change the navigation in the shell?

    Let's say I have a RibbbonBarTheme that use a RibbonBar as application menu (like mspaint) and PanelBarTheme that change the menu to be a PanelBar (like a conventional web site).

    With this solution, all modules know that the shell uses a RibbonBar as application menu so if you change the shell, you must modify each module.

    I think Prism is designed to avoid this type of situation, no? Is it not better to create our own clr objects that will contains the information of the menu and use the adapter system of PRISM to generate all items of RibbonBar or other control used by the shell?

    dfdfThis solution works but what happens if my application has two themes that change the navigation in the shell?

    Let's say I have a RibbbonBarTheme that use a RibbonBar as application menu (like mspaint) and PanelBarTheme that change the menu to be a PanelBar (like a conventional web site).

    With this solution, all modules know that the shell uses a RibbonBar as application menu so if you change the shell, you must modify each module.

    I think Prism is designed to avoid this type of situation, no? Is it not better to create our own clr objects that will contains the information of the menu and use the adapter system of PRISM to generate all items of RibbonBar or other control used by the shell?

    Then we just need to create an adapter for each type of navigation, we decide to use in the shell and we don't have to change any module. We can even use this objects as a source of binding for the menu items.
    an adapter for each type of navigation, we decide to use in the shell and we don't have to change any module. We can even use this objects as a source of binding for the menu items.

    Reply

  • Yann avatar

    Posted on Oct 31, 2010 (permalink)

    This solution works but what happens if my application has two themes that change the navigation in the shell?

    Let's say i have a RibbonBarTheme that use a RibbonBar as application menu (like mspaint) and a PanelBarTheme that change the menu to be a PanelBar (like a classic web site).

    With this solution, all modules know that the shell use a RibbonBar as application menu so if you change the shell you must modify each module.

    I think Prism is designed to avoid this type of situation, no? Is it not better to create our own clr objects that will contains the information of the menu and use the adapter system of PRISM to generate all items of the RibbonBar or other control used by the shell ?

    Then we just need to create an adapter for each type of navigation we decide to use in the shell and we don't have to change any module. We can even use this objects as a source of binding for the menu items.


    PS: Sorry for my previous blank post.

    Reply

  • Miro Miroslavov Miro Miroslavov admin's avatar

    Posted on Nov 3, 2010 (permalink)

    Hi Yann,

     You have a point, and I agree with you, but this example was made simple for the sake of simplicity. In the more complex scenarios (like yours) you will need to use the full power of the Prism - dynamically created modules.
    In other scenario, as you know you can have a couple of static things (like the ribbon menu) and lets say the rest could be dynamic modules. 
    Thank you for your thoughts, also will be great if you can share some example, code, or what you think can be helpful.
    Thank you.

    Regards,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Yann avatar

    Posted on Nov 6, 2010 (permalink)

    Sorry for this delay. I understand your point.

    I made a sample project but i cannot upload it directly here. Where should i upload the zip file ?

    Reply

  • Miro Miroslavov Miro Miroslavov admin's avatar

    Posted on Nov 10, 2010 (permalink)

    Hello Yann,

     You can send a "Code Library" project.

    Regards,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Yann avatar

    Posted on Nov 10, 2010 (permalink)

    It's posted under the name "How to use the RadRibbonBar as Prism Region" in the silverlight section "General and Integration Projects" you just need to approve ;)

    Reply

  • k f avatar

    Posted on Nov 24, 2010 (permalink)

    I created a template for a modular, SL 4 app, using the RibbonBar, with the concepts of MVVM utilizing MEF with Prism 4.

    Also, I've created a QATBRegionAdapter so you can add a region to the QuickAccessToolbar.
    You can download the template at:

    http://www.dotnetpatterns.net/content/185-Silverlight-4.0-Prism-4.0-Telerik-Ribbon-Application-Template

    I'm keeping it there as it's easier for me to update.  Also, if you have questions please post them on the site.

    Reply

  • Kais avatar

    Posted on Mar 10, 2011 (permalink)

    Hi all, 

    I'm interested in implementing this using Radcontrols for WPF and have a question for you. The RadRibbonTabs that are injected by Prism cannot be viewed in the designer (if your UserControl's base class is RadRibbonTab). Has anyone got a workaround to be able to view the tab's and inject into a ribbon bar? 

    Doesn't need to be pretty. Doesn't even need to be Prism RegionManager. I'd use a code-only solution if necessary. 

    Thanks, 

    Reply

  • Petar Mladenov Petar Mladenov admin's avatar

    Posted on Mar 15, 2011 (permalink)

    Hi Kais,

    Could you please elaborate more on your scenario? What are the dll version of the RibbonBar that you are using? Have you tested this in a simpler scenario, just drag RadRibbonTabs from the toolbox into the RadRibbonBar? As I manage to understand, the problem is more generic than custom-scenario-related problem. However, if the problem doesn't occur in more generic scenario, you could send a runnable sample showing the issue and this way we could investigate it in depth and provide you with a better advice. Thank you in advance for your cooperation.

    All the best,
    Petar Mladenov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!

    Reply

  • Jose Jones avatar

    Posted on Jul 28, 2011 (permalink)

    I'm struggling with a problem for a quite a long time.  I decided to update the HelloWorld.Silverlight solution with the latest Prism and Telerik binaries (2011.2.712.1040) and now I have the same issue on your solution.

    RadRibbonTab are correctly injected but we only see the header of the tab.  Looks like there is no default selection that is made... (see the attached file)

    Thanks for your help...


    Attached files

    Reply

  • Tina Stancheva Tina Stancheva admin's avatar

    Posted on Aug 2, 2011 (permalink)

    Hi Jose Jones,

    This is a known issue that is caused by the RadRibbonBar selection implementation. Due to this and the other known limitations of the RadRibbonBar control we decided that it would be best to provide a new implementation of the control - RadRibbonView. It basically keeps the RadRibbonBar API but it significantly improves its functionality, databinding and design time support. You can find more info about the differences between the two controls here and you can also examine the RadRibbonView MVVM demo sample here.

    This is why in your application if you replace the RadRibbonBar control with a RadRibbonView control, the selection issue you described should be fixed. Give it a try and let us know how it goes.

    Also, you may find the sample projects attached and discussed in this code library thread useful. They are all utilizing the RadRibbbonBar control, but you should be able to replace this control with the RadRibbonView control out-of-the-box if you decide to take on the new ribbon implementation.

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > RibbonBar > RadRibbonBar as PRISM Region