Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
(Urgent)how to write??RibbonGroup as a reusable resource


I have different tabs in Ribbon,

I have a File RibbonGroup, which is common across tabs

Is there anyway to make ribbon shared across tabs?

if not, reuable style resource like..


<Style TargetType={x:Type igRibbon:RibbonGroup}>

<Setter Property="Items">  <!-- not sure what to put here as property-->







  • 54937
    Suggested Answer
    Offline posted

    You cannot define an itemscontrol (which the RibbonGroup is) in that way and be able to populate the Items collection. The way to do this would be to define a xaml file that defines a RibbonGroup and then use the Application.LoadComponent method to new up an instance of it at runtime.  e.g. create a file named CommonRibbonGroup.xaml with the following content

    <igRibbon:RibbonGroup xmlns=""
        <igRibbon:ButtonTool Caption="First" />
        <igRibbon:ButtonTool Caption="Second" />

    Then at runtime you could instantiate instances of that uses the Application.LoadComponent method. e.g.

    Uri relativeGroupUri = new Uri("/CommonRibbonGroup.xaml"UriKind.Relative);
    AddRibbonGroup(this.tabA, 0, relativeGroupUri);
    AddRibbonGroup(this.tabB, 0, relativeGroupUri);
    AddRibbonGroup(this.tabC, 0, relativeGroupUri);
    private static void AddRibbonGroup(RibbonTabItem tab, int preferredIndex, Uri ribbonGroupUri)
    RibbonGroup group = (RibbonGroup)Application.LoadComponent(ribbonGroupUri);
    int index = Math.Max(0, Math.Min(preferredIndex, tab.RibbonGroups.Count));
    tab.RibbonGroups.Insert(index, group);


    Alternatively you could derive a class from RibbonGroup and create instances of that instead of using LoadComponent but then the class will not follow the styling of the other elements if you set the Theme since in WPF a local style is always located based on the type name which in that case would be your derived type.