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
245
RibbonGroup as Resources
posted

Hi everybody,


in my business application I'm using a ribbon bar and on more than one tab we need to have a date selection. I don't want to define it on every tab, instead I want to re-use the same definition.

So, I've defined a ribbon resources:

<igRibbon:XamRibbon.Resources>
 
                    <igRibbon:RibbonGroup Caption="{local:Translation Key=Common.Refresh}" x:Key="DateSelection">
                        <ig:LabelTool Caption="{local:Translation Key=Common.DateFrom}" />
                        <ig:XamDateTimeEditor MaxHeight="40" VerticalAlignment="Top" x:Name="dateFrom"/>
                        <ig:LabelTool Caption="{local:Translation Key=Common.DateTo}" />
                        <ig:XamDateTimeEditor MaxHeight="40" VerticalAlignment="Top" x:Name="dateTo"/>
                        <igRibbon:ButtonTool Caption="{local:Translation Key=Common.Refresh}" Click="DateSelection_Click"/>
                    igRibbon:RibbonGroup>



Now, I want to consume it, at least on two tabs. But how shell I do this?

<igRibbon:RibbonTabItem Header="{local:Translation Key=LblM.SerialHis}" Uid="SerialHis">
           ???
igRibbon:RibbonTabItem>



How I have to refered to the defined resources?

Thanks in advance!

Parents
No Data
Reply
  • 34430
    Verified Answer
    Offline posted

    Hello Timon,

    Thank you for your post.

    Currently, when you populate the space between the opening and closing tabs of a RibbonTabItem, you are populating a RibbonGroupCollection object. The fact that you are populating a collection disallows the usage of your RibbonGroup as a resource here, but there is another way that you can reuse your RibbonGroup in this case. My recommendation to you would be to create your own custom class that derives from RibbonGroup and populate that RibbonGroup's Items collection in its constructor. Then, by creating a new "local" namespace, you can place your custom-created RibbonGroup between the opening and closing tags of your RibbonTabItem.

    One issue that could pop up here is if you are looking to set the "Id" property of your RibbonGroup or the tools that exist inside it. Why this is an issue is because the XamRibbon will not allow tools or RibbonGroups to be added to it if those groups or tools have the same Id, and you will receive an exception if you try to do this. I am unsure if this is currently an issue for you, but I just thought I would make you aware of it. If it is indeed an issue for you, though, please let me know and I will see if I can workaround it in some way.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

Children