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!
Hello Andrew,
thanks for your quick and good support! Is's working in this way! Great! Only the not-so-good thing is for me, that it's written in C# and not in XAML - but this is okay. May be you'll find a way to define those things in XAML in future versions.
And your thoughts of the id property didn't affected me since I don't set the id property.
Have a good day!
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,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support