How can I iterate through a group of buttons on the ribbon and disable them, instead of using FindById for every buttontool.
Thanks
HI,
Here is a loop that will disable all the buttons in a group
foreach (ButtonTool bt in MyRibbon.Tabs[0].Groups[0].Tools)
{
bt.IsEnabled =
false;
}
Sincerely, MattDeveloper Support Engineer
Thanks Matt
It works correctly, except if the buttons are in a VerticalRibbonToolContainer which then gives an InvalidCastException.
Surely, accessing the buttontools via MyRibbon.Tabs[0].Groups[0].Tools would mean that it also includes buttontools within buttontool layout containers? It is my understanding that the VerticalButtonToolContainer only repositions the buttons and should not have an influence on how they should be accessed from the context of "MyRibbon.Tabs[0].Groups[0].Tools".
Regards
I am attaching a sample that traverses the VerticalButtonToolContainer and disables each buttontool inside of it..
Sincerely,
Matt Developer Support Engineer
Please let me know if you need further assistance regarding this issue.
Thank you Matt, it works perfectly.