I added 5 tabs to an UltraTabControl, yet it displays 10 tabs!
Debugging it, the UltraTabControl.Controls.Count is 6 (my 5 plus the shared page) when my initialization code yields to the winforms framework.
When the UI displays, every tab is in there twice, once with my tab text/label, once with out it but the same controls.
Debugging it, ultraTabControl1.Controls.Count is still 6.
Setting ultraTabControl1.Style to Wizard would hide this. But, why would each tab be displayed twice???
The code in the Form's Load event is adding tabs to the Ribbon of an UltraToolbarsManager. The code in the AfterRibbonTabSelected event handler is trying to access tabs in an UltraTabControl with the same key as the selected tab from the ribbon. Although both the Ribbon and UltraTabControl have the concept of 'Tabs', they are not the same type of tabs and they will not be kept in sync. Even if you have two different UltraTabControl instances, their tabs will not be kept in sync. The code just happens to work correctly in the sample because the tabs of the Ribbon and UltraTabControl were manually given the same keys so selected tabs could be kept in sync more easily. If you change the keys of one set of tabs, you will also have to change the keys of the other set if you want to use the same code in the AfterRibbonTabSelected handler.
> Did you add these tabs through the designer or at runtime?
A combo of the two; the idea was to do what the "Ribbon at Runtime CS" does programmatically via the drag-n-drop designer. (Something more suitable for RAD GUI development, code-only approaches just doesn't cut it).
> If it was at runtime, it is difficult to say what is wrong without seeing some of the code used to add the tabs.
Here's an example (from Infragistics support showing there are no problems):
{
RibbonTab tab = ribbon.Tabs.Add("Home");
...
RibbonTab tab1 = ribbon.Tabs.Add("Show");
RibbonTab tab11 = ribbon.Tabs.Add("Close");
}
Now, decide you want a different tab structure. In the *code only* above:
(a) change the name of one of the above, and/or
(b) add new tabs
And, this blows up:
Because the code is dependent upon Designer code. For example, change "Home" above to "Home2" and you get the above exception, because Designer code is no longer in-synch with your code:
ultraTab1.TabPage = this.ultraTabPageControl1;
Did you add these tabs through the designer or at runtime? If it was with the designer, there may be a bug and I would recommend submitting it to the support group: http://es.infragistics.com/gethelp. If it was at runtime, it is difficult to say what is wrong without seeing some of the code used to add the tabs. If you post some of the code, I might be able to help determine what is wrong.