This is a migrated thread and some comments may be shown as answers.

Problem clearing ribbon bar (Q1 2010)

1 Answer 76 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Ben Hyrman
Top achievements
Rank 1
Ben Hyrman asked on 04 Apr 2010, 09:52 PM
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:

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





1 Answer, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 08 Apr 2010, 07:01 AM
Hello Ben,

 Thanks for contacting us and for reporting this issue.


I would like to inform you that this issue has been introduced as of Q1 2010 and we are aware of it. We have already corrected this behavior and the fix will be released within Q1 2010 SP1 which is due to a couple of days.

Please, refer to our website for further details on the new release.

Please, excuse us for the inconvenience and thanks for the understanding.

Regards,
Deyan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
RibbonBar
Asked by
Ben Hyrman
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Share this question
or