Morning,
I need to know if tis possible to make a copy of a group on one tab and then assign that copy to another tab?
So I have a tab with a group designed on the form.
At run time new tabs are created. For each of these tabs I want to add a copy of that group.
Dim objRoomToolsGrp As New RibbonGroup("Tools")
objRoomToolsGrp = uwTBMgr.Ribbon.Tabs(0).Groups(2)
then I would assign that copy like so:
uwTBMgr.Ribbon.Tabs(objDir.Name).Groups.Add(objToolsGrp)
But I am getting an error telling me its already assigned to another parent tab.
how do I make a copy of the group that isn't assigned to a tab? And then assign it to the tab I want it on?
hope that makes sense.
Thanks
Deasun
got a bit further, playing around.
Dim objToolsGrp As New RibbonGroup("Tools")
objToolsGrp = objRoomToolsGrp
objToolsGrp.Key = "Tools-" & objDir.Name
objToolsGrp.ParentCollection.Clear()
when I use, objToolsGrp.ParentCollection.Clear(), I do get a copy of the group, with all its tools, but its only on the last tab created.
All the tabs in front of it don't have the group.
puzzled!
also the actual error msg I get is: The specified group already belongs to a different RibbonTab.
also, related to this, is it possible to change the tabs index at runtime?
So at design the tab is 0 but now during runtime I would like to move it to the end of the tab list, say 10.
Hello Deasun,
Thank you for contacting Infragistics Developer Support.
What you can do in order to copy the ribbon group from on tab to another is to add another group to the tab you want to copy the group to and then copy all the tools to it. You can do that using code like this (the following lines copy the first group of the first tab to the second tab):
Dim group = UltraToolbarsManager1.Ribbon.Tabs(0).Groups(0)
UltraToolbarsManager1.Ribbon.Tabs(1).Groups.Add(group.Key)
For Each tool As ToolBase In group.Tools
UltraToolbarsManager1.Ribbon.Tabs(1).Groups(group.Key).Tools.AddTool(tool.Key)
Next
Please note that since the same tools will be displayed into the second group any changes on the tools of the first group will affect the tools of the second (they are same objects).
As for changing the index at runtime, this is not possible, it depends on the order the tabs are added to the ToolbarsManager. If you want to reposition the tabs in runtime, you can use the Reposition method of the ribbon tab. The following line will move the second tab to the first position.
UltraToolbarsManager1.Ribbon.Tabs(1).Reposition(UltraToolbarsManager1.Ribbon.Tabs(0), Infragistics.Win.RelativePosition.Before)
For more information on this method, please visit this link:
http://help.infragistics.com/Doc/WinForms/2013.2/CLR4.0/?page=Infragistics4.Win.UltraWinToolbars.v13.2~Infragistics.Win.UltraWinToolbars.RibbonTab~Reposition.html
I have attached a sample which demonstrates my suggestion.
Please let me know if you have any additional questions.
Thanks! :)