I have a toolbar displayed with my application.
I would like to have a number of the toolbar buttons/tools not displayed in the toolbar (by default at startup), but I would like the user to be able to add the invisiable button/tools later via the "Add or Remove Buttons" menu item.
However if I set the SharedProps.Visible = false for the button/tool so that it doesn't show up in the toolbar, then it isn't available as an option in the "Add or Remove Buttons" menu item.
No matter what combination of settings I've tried, if the button/tool is not visible at startup in the toolbar, then it won't be displayed in the "Add or Remove Buttons" menu.
Any suggestions as to what I can try to not display the button/tool in the toolbar at startup, but to allow the user to add it there later via the "Add or Remove Buttons" toolbar menu.
Hide the tool by code using the CustomizedVisible Property
ultraToolbarsManager1.Toolbars[0].Tools[0].CustomizedVisible = Infragistics.Win.DefaultableBoolean.False;
I added that code but the tools still appeared in the Toolbar, although they are disabled as a result of adding this code.
I also tried a number of permutations of the code (setting Enabled to false and CustomizedVisible to false for example) but nothing I did would allow me to have the tools NOT appear in the toolbar, but show up in the Add or Remove buttons menus.
Any other ideas?
Here's a sample of the code that I tried to use to get this to work:
ultraToolbarsManager.Tools[0].SharedProps.Visible = false; ultraToolbarsManager.Tools[1].SharedProps.Visible = false; ultraToolbarsManager.Tools[0].CustomizedVisible = DefaultableBoolean.True; ultraToolbarsManager.Tools[1].CustomizedVisible = DefaultableBoolean.True;
I've also tried just this as you had suggested with no luck:
ultraToolbarsManager.Tools[0].CustomizedVisible = DefaultableBoolean.False; ultraToolbarsManager.Tools[1].CustomizedVisible = DefaultableBoolean.False;
Hi,
Let me know if you need any additional help.
Regards,
Stefaniya
In your second implementation you refer to the RootToolsCollection on which the set value is ignored, so you should use the ToolsCollection to affect the tools in the toolbar.
Let me know if you have any further questions or need any help.
I'm a bit confused - however I did get it working based on your latest sample. This version of the code works:
ultraToolbarsManager.Toolbars[1].Tools["Tool1"].CustomizedVisible = DefaultableBoolean.False; ultraToolbarsManager.Toolbars[1].Tools["Tool2"].CustomizedVisible = DefaultableBoolean.False;
But this one didn't
ultraToolbarsManager.Tools["Tool1"].CustomizedVisible = DefaultableBoolean.False; ultraToolbarsManager.Tools["Tool2"].CustomizedVisible = DefaultableBoolean.False;
Any idea why the second version of the code wouldn't work? I have two toolbars, however my understanding is that ultraToolbarsManager.Tools returns a list of all the Tools for all the toolbars, and since it didn't throw an exception, should have returned the same tool as the first version of the code that worked.
As Hady suggested you need to set the CustomizedVisible property of the non-root tool in the toolbar to false and it will be not visible on the toolbar.
For example:
ButtonTool btn = ultraToolbarsManager1.Toolbars[0].Tools["ButtonTool1"] as ButtonTool ;
btn.CustomizedVisible = Infragistics.Win.DefaultableBoolean.False ;
Let me know if this works for you.
which version are you using?
i tried it on the version 9.2 and it's working fine