title: PRISM + Tabs = Pain
body: <p>I am having difficulty trying to get a very simple scenario working with PRISM 2.0 for WPF. I want the main workarea of my application to be a <code>TabControl</code>. Each time I add a view, I want it to appear as a <code>TabItem</code> on the <code>TabControl</code>.</p>
  
  <p>Sounds easy right?</p>
  
  <p>My region, which is in my Shell.XAML looks like this:</p>
  
  <pre><code>&lt;Controls:TabControl 
      Name="MainRegion" 
      cal:RegionManager.RegionName="{x:Static Infrastructure:RegionNames.TabRegion}"
      ItemContainerStyle="{StaticResource ShellTabItemStyle}" /&gt;
  </code></pre>
  
  <p>The style: <code>ShellTabItemStyle</code> looks like this:</p>
  
  <pre><code>&lt;Style x:Key="ShellTabItemStyle" TargetType="{x:Type TabItem}"&gt;
      &lt;Setter Property="Header" Value="{Binding Content.DataContext.HeaderInfo, RelativeSource={RelativeSource Self}}" /&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>This should set the <code>Header</code> of the <code>TabItem</code> to the <code>HeaderInfo</code> property on the <code>DataContext</code> of the view. (I got this idea from <a href="http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=30673" rel="nofollow noreferrer">this article</a>) The <code>DataContext</code> of my view is a very simple <code>Presenter</code> which has a <code>HeaderInfo</code> property on it:</p>
  
  <pre><code>public string HeaderInfo = "The Header Text";
  </code></pre>
  
  <p>My view is a simple WPF usercontrol and looks like this: </p>
  
  <pre><code>  &lt;StackPanel&gt;
      &lt;TextBox Text="Hello World" Name="MyTextBox"&gt;&lt;/TextBox&gt;
      &lt;Image Source="..SomeImage.PNG" Name="MyImage"&gt;&lt;/Image&gt;
    &lt;/StackPanel&gt;
  </code></pre>
  
  <p>So far, so good. If I add the view to the region I get a tab control and I get a tab with the text set to "The Header Text". My problem is that there is absolutely no content appearing on the tab. My view contains a simple <code>Image</code> and a <code>TextBox</code>, but neither of them show up in the <code>TabItem</code>.  If I break out Snoop and look around, there isn't an image in sight.</p>
  
  <p>What am I missing here - is there an easier way?</p>