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

Adding Tabs to collapsed Ribbonbar

2 Answers 252 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 26 Oct 2015, 04:21 PM

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");
this.radRibbonBar1.CommandTabs.Add(tab);
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.

Thanks,

John

2 Answers, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 27 Oct 2015, 02:20 PM
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);
this.radRibbonBar1.CommandTabs.Add(tab);
tab.IsSelected = true;
this.radRibbonBar1.Expanded = isExpanded;

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

Regards,
Todor Vyagov
Telerik
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
0
John
Top achievements
Rank 1
answered on 29 Oct 2015, 08:01 AM

OK that seems to work fine.

Thanks.

Tags
RibbonBar
Asked by
John
Top achievements
Rank 1
Answers by
Todor
Telerik team
John
Top achievements
Rank 1
Share this question
or