views:

139

answers:

1

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>
A: 

Use data to model your UI. i.e. view models. Generate the UI from those view models:

<TabControl ItemsSource="{Binding Items}"

Then you can combine these models into collections as you see fit, and generate the UI from those collections.

HTH,
Kent

Kent Boogaart
I forgot to mention this. The first list of items are static, while the second list is dynamically loaded from another assembly. I want to leverage the design time environment to layout my controls on the individual tab pages. I don't see how I can do this with a view model, since I would have to recreate all these controls using templates and code. Moreover, these controls contain data such as settings which are stored in the assemblies' settings file. If I can somehow only bind the individual TabItems instead of an entire TabControl, this would solve my problem.
Joel Rodgers
Please also let me add that my previous solution was to load the assembly that contains TabControl2 and copy its individual TabItems to Control1. This works, but not as clean and dynamic as I would like. I could live with this, but is there a way to "combine" these two TabControls, i.e. easily insert TabItems from one to another at a given node?
Joel Rodgers