Hi
I want a separator between two tools in the ribbon group(Vertical line between the tools as in Sort & Filter group in the Data tap in the MicroSoft Excel sheet ). I am setting the InstanceProp .IsFirstInGroup to true, but the separator is not coming between the tools.Someone please help me to solve the above mentioned problem.
Thanks in advance
Regards
Navi
From what I understand, you are trying to set it through code. When a tool is added to a ribbon group, actually a clone is created and that is added. The InstanceProps are not copied to the new object, so you'll need to get the newly created tool and then set the IsFirstInGroup property. What I am doing is to create the tool, set it's properties and the properties in the SharedProps collection, add it to the ribbon group, get the new instance of the tool and set it's InstanceProps' properties:
// create the tool
ButtonTool tool = new ButtonTool("key");
tool.PropertyX = PropertyXValue;
tool.SharedProps.PropertyY = PropertyYValue;
// add it to the root collection of the UltraToolbarManager
toolbarManager.Tools.Add(tool);
// add it to the tools of the ribbon group and get the new instance
tool = ribbonGroup.Tools.AddTool(key);
// now you can set the instance props
tool.InstanceProps.PropertyZ = PropertyZValue;
You can find a good example here.
HTH,
Emanuel
Hi Emanuel Haisiuc
Thanks for the reply.
Actually I setting the IsFirstInGroup to true exactly the way you have said. The code I am using is
ButtonTool InvestmentTool = new ButtonTool("Investment"); InvestmentTool .SharedProps.Caption = "Investment"; InvestmentTool .SharedProps.Tag = this; m_ToolBarManager.Tools.Add(InvestmentTool ); m_ToolBarManager.Ribbon.Tabs["Charts"].Groups["Betting Charts"].Tools.AddTool(InvestmentTool .Key); m_ToolBarManager.Ribbon.Tabs["Charts"].Groups["Betting Charts"].Tools["Investment"].InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large; m_ToolBarManager.Ribbon.Tabs["Charts"].Groups["Betting Charts"].Tools["Investment"].InstanceProps.IsFirstInGroup = true;
Can you suggest me, what is going wrong in this code.
Looks ok to me. And for me it works, at least with Infragistics 2008.2 build 2022.
I would try to get the new instance returned by the AddTool method on ToolsCollection of the ribbon group, set it's InstanceProps and check to see if they are set on the instance referred by m_ToolBarManager.Ribbon.Tabs["Charts"].Groups["Betting Charts"].Tools["Investment"]:
ButtonTool addedInvestmentTool = m_ToolBarManager.Ribbon.Tabs["Charts"].Groups["Betting Charts"].Tools.AddTool(InvestmentTool .Key);addedInvestmentTool.InstanceProps.PreferredSizeOnRibbon = RibbonToolSize.Large;addedInvestmentTool.InstanceProps.IsFirstInGroup = true;if (addedInvestmentTool.InstanceProps.IsFirstInGroup != m_ToolBarManager.Ribbon.Tabs["Charts"].Groups["Betting Charts"].Tools["Investment"].InstanceProps.IsFirstInGroup){ throw new Exception("IsFirstInGroup property could not be set!");}
Thanks Mike
It sounds like there may have been a bug in 7.1. Unfortunately, this version is no longer supported, so you will have to upgrade to a later version or a newer hotfix of 7.1 to get this working.
The code you have sent is worked for me, i.e I didnot get any exception. But still I didnot get the separator.
I am using Infragistics 2007 Volume 1 CLR 2.0 build. Is this problem due to the my version of the Infragistics?