How do I bind one TabControl to the TabItems of another TabControl in WPF?

Posted by joebeazelman on Stack Overflow See other posts from Stack Overflow or by joebeazelman
Published on 2010-04-19T01:14:49Z Indexed on 2010/04/19 1:23 UTC
Read the original article Hit count: 464

Filed under:
|
|
|

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>

© Stack Overflow or respective owner

Related posts about wpf

Related posts about wpf-controls