or
| string[] buttons = { "button 1", "button 2", "button 3" }; |
| var navTab = new RibbonTab("Tab"); |
| foreach (var buttonName in buttons) |
| { |
| var group = new RadRibbonBarGroup(); |
| group.Text = buttonName; |
| var button = new RadButtonElement(buttonName); |
| group.Items.Add(button); |
| navTab.Items.Add(group); |
| } |
| radRibbonBar1.CommandTabs.Add(navTab); |
| radRibbonBar1.CommandTabs.Clear(); |
| var countOfTabs = this.radRibbonBar1.CommandTabs.Count; |
| for (int i = countOfTabs - 1; i >= 0; i--) |
| { |
| int countOfGroups = radRibbonBar1.CommandTabs[i].Children.Count; |
| for (int j = countOfGroups - 1; j >= 0; j--) |
| { |
| int countOfButtons = radRibbonBar1.CommandTabs[i].Children[j].Children.Count; |
| for (int k = countOfButtons - 1; k >= 0; k--) |
| { |
| radRibbonBar1.CommandTabs[i].Children[j].Children.RemoveAt(k); |
| } |
| radRibbonBar1.CommandTabs[i].Children.RemoveAt(j); |
| } |
| radRibbonBar1.CommandTabs.RemoveAt(i); |
| } |