Problem clearing ribbon bar (Q1 2010)

2 posts, 0 answers
  1. Ben Hyrman
    Ben Hyrman avatar
    3 posts
    Member since:
    Feb 2004

    Posted 04 Apr 2010 Link to this post

    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





  2. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 08 Apr 2010 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top