Adding Tabs to collapsed Ribbonbar

3 posts, 1 answers
  1. John
    John avatar
    2 posts
    Member since:
    Jun 2014

    Posted 26 Oct 2015 Link to this post

    I'm trying to programmatically add a tab to the Ribbonbar at runtime. It all works fine when the Ribbonbar is expanded. But when I add a tab to a collapsed Ribbonbar the new tab is not visible until I click the button to expand the Ribbonbar again. Here are the steps to reproduce:

    1.Create a new Visual C# -> Telerik Windows Forms Application

    2.Drag a RadRibbonBar control onto RadForm1

    3.Create a single tab "First Tab" (otherwise you cannot collapse the ribbon)

    4.Drag a button onto the form and add the following code to the click event handler:

    RibbonTab tab = new RibbonTab("Test");
    tab.IsSelected = true;

    5.You should end up with something like the attached png file.

    6.Run the project and click the button. You should see the new tab is created and selected.

    7.Close the project and run it again. This time collapse the ribbon before clicking the button. No new tab is visible on the ribbon. Even if you click on the [First Tab] to show the full ribbon.

    8.Click the expand ribbon button on the right and the new tab will then appear.

    I've tried adding lines like Application.DoEvents() or this.Refresh() or this.radRibbonBar1.Refresh() but it doesn't make a difference.

    Any help would be much appreciated.



  2. Answer
    Todor Vyagov
    Todor Vyagov avatar
    31 posts

    Posted 27 Oct 2015 Link to this post

    Hi John,

    Thank you for writing.

    I successfully reproduced your scenario and I can confirm this is an issue. This is why I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment on the following link - feedback item.

    I have also updated your Telerik points.

    As a workaround, you can expand the ribbon, add the new tab and collapse it again.
    bool isExpanded = this.radRibbonBar1.Expanded;
    this.radRibbonBar1.Expanded = true;
    RibbonTab tab = new RibbonTab("Test " + this.radRibbonBar1.CommandTabs.Count);
    tab.IsSelected = true;
    this.radRibbonBar1.Expanded = isExpanded;

    I hope this information helps. If you have any additional questions, please let me know.

    Todor Vyagov
    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 Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. John
    John avatar
    2 posts
    Member since:
    Jun 2014

    Posted 29 Oct 2015 in reply to Todor Vyagov Link to this post

    OK that seems to work fine.


Back to Top