Greetings,
I'm using the Q1 2010 WinForm Rad Ribbon Bar.
I populate a ribbon bar based on some application state. However, when I later try to clear the ribbon bar, it deletes the tab but not the groups or buttons.
Here's some example code to populate the ribbon bar:
I've tried several options for clearing the ribbon bar. From a simple:
To attempting to walk and remove each button and then group and then tab:
am I missing something obvious?
Thanks!
Ben
I'm using the Q1 2010 WinForm Rad Ribbon Bar.
I populate a ribbon bar based on some application state. However, when I later try to clear the ribbon bar, it deletes the tab but not the groups or buttons.
Here's some example code to populate the ribbon bar:
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); |
I've tried several options for clearing the ribbon bar. From a simple:
radRibbonBar1.CommandTabs.Clear(); |
To attempting to walk and remove each button and then group and then tab:
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); |
} |
am I missing something obvious?
Thanks!
Ben