Posted
on Nov 18, 2011
(permalink)
Hi Michael,
I'm sure it's too late for you (post is from 2 years ago), but this will hopefully help if someone else stumbles upon the same issue. I had this same issue occur. I could see in the designer.cs that the controls were all there, but they were not being rendered. Doing a little experimentation, I found out what happened and how to fix it without starting over.
There is a bug somewhere in the Telerik Ribbon control that removes all the calls to add the items to the collections. In other words, the code is there to create the individual buttons and button groups, but the code to actually add them to their parent controls is removed by the telerik control. In my case, I had several groups with buttons arranged and events tied
to the buttons so recreating them would have taken many hours. I'm not sure why this happens, but here is how to get them back without having to create them from scratch. First, keep in mind that there is a hierarchy...
Ribbon Control
---Tab
------Ribbon Bar Group
---------Button Group (horizontal or vertical)
------------Button (or other control)
------------Button
...etc.
For each one, you'll just have to add the Tabs to the Ribbon Bar, the Ribbon Bar Groups to the Tabs, the Button Groups to the Ribbon Bar Groups and so on down the line. Although a bit tedious, it is a lot better than starting over.
Tabs can be added to the main ribbon with the following line:
this.MainRibbonBar.CommandTabs.AddRange(new Telerik.WinControls.RadItem[] { this.rbntabHome, this.rbntabView });
--put your tabs into the list at the end separated by commas. Also, MainRibbonBar should be the name of your ribbon bar.
All other collections in the hierarchy can be added with the following line:
this.grpSpecPlan.Items.AddRange(new Telerik.WinControls.RadItem[] {btngrpSpecPlan1, btngrpSpecPlan2});
This works for Ribbon Bar Groups to the Tabs, Button Groups, Buttons, etc. All of them. Just replace the parent and children.
this.[parent].Items.AddRange(new Telerik.WinControls.RadItem[] {[item1], [item2]});
Hope this helps someone down the line. I was literally freaking out thinking I was going to have to start all over.
Jason