How do I bind one TabControl to the TabItems of another TabControl in WPF?
- by joebeazelman
I've defined the following TabControl called TabControl1:
<TabControl>
<TabItem Header="Cheese">
The Cheese Tab
</TabItem>
<TabItem Header="Pepperoni">
The Pepperoni Tab
</TabItem>
<TabItem Header="Mushrooms">
The Mushrooms Tab
</TabItem>
</TabControl>
I've defined another TabControl, TabControl2 which is dynamically loaded from an add-in or plugin:
<TabControl>
<TabItem Header="Anchovies">
The AnchoviesTab
</TabItem>
<TabItem Header="Jalepenos">
The Jalepenos Tab
</TabItem>
<TabItem Header="Rattle Snake">
The Rattle Snake Tab
</TabItem>
</TabControl>
After TabControl1 binds to TabControl2 after the "Cheese" item, TabControl1 should look like this:
<TabControl>
<TabItem Header="Cheese">
The Cheese Tab
</TabItem>
<TabItem Header="Anchovies">
The AnchoviesTab
</TabItem>
<TabItem Header="Jalepenos">
The Jalepenos Tab
</TabItem>
<TabItem Header="Rattle Snake">
The Rattle Snake Tab
</TabItem>
<TabItem Header="Pepperoni">
The Pepperoni Tab
</TabItem>
<TabItem Header="Mushrooms">
The Mushrooms Tab
</TabItem>
</TabControl>