I am adding tool items to a toolbar pragmatically. Everything is fine except i am unable to change the index of tool items through code. The index property of ButtonTool is read only. Is there any way to change the index of button tools through code? Any Idea?
Thanks,
Whlie I don't have a development environment available to test this, here's the basic approach I've described:
using Infragistics.Win.UltraWinToolbars;...ToolBase toolToMove = ultraToolbarsManager1.Toolbars["MyToolbar"].Tools["ToolToMove"];ultraToolbarsManager1.Toolbars["MyToolbar"].Remove(toolToMove);ultraToolbarsManager1.Toolbars["MyToolbar"].InsertTool(0, "ToolToMove");
What *IS* the multi-step way to move a Tool to a new location?
Is it Tools.Remove(tool) + Tools.Insert(index, key)?
Thats worked... Thanks!!
I can't find a one-step way to move items within a toolbar. However, since you're programmatically adding them anyway, you could probably use the Insert() method off the Tools collection, rather than using the Add() method to add the tool to the end.
In the absence of a better approach, the way I'd move a tool is to get a reference to the instance in the toolbar, remove it from that toolbar's Tools collection, and then insert it back to the Tools collection where I want it.