What am I missing?
It seems that you are missing a great deal. WPF is simply not written like that. In WPF, we manipulate data elements, not UI elements. We declare DataTemplate
s that define how our data should be rendered in the UI, so to add a new TabItem
in a TabControl
, you add a new data item into a data collection that is data bound to the ItemsSource
property of the TabControl
.
So you can create a RibbonTab
from classes, but those classes do not manually build the UI elements, instead they provide the data for the controls. For example, to add a Button
, you'd need a class that had a couple of string
properties to data bind to the Button.Content
and ToolTip
properties. It would also need an ICommand
property to data bind to the actual Command
property. To add a new Button
, you just add another of these classes into the relevant collection.
As to what class goes in what collection, well that is far to long a story to cover here. Luckily, the topic of data binding RibbonTab
controls has been widely discussed online, so you'll have plenty of good sources for that. Don't forget MSDN is a great resource... there are plenty of relevant links from the Ribbon Overview page.