title: Instantiating a new UserControl programmatically while setting a DataContext to facilitate binding
body: <p>Starting with the <a href="https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/tree/master/MahMaterialDragablzMashUp" rel="nofollow noreferrer">MahApps-Material mashup demo</a>, I'm trying to use a button click event to create a new <code>TabItem</code> from my Views. For now, the <code>CustomTabItem</code> will show text bound to some property from a <code>FancyObject</code> (being served to the View from my <code>FancyTabViewModel</code>). But I've got the DataContext, dependency property or the Binding done wrong.</p>
  
  <pre><code>    public void NewTabOnClick(object sender, RoutedEventArgs e)
      {
          // create my new object from Models 
          FancyObject fo = new FancyObject();
          // create the INofify VM and pass it my object
          // the VM has a public VMFancyObject property to serve the fo
          FancyTabViewModel fvm = new FancyTabViewModel(fo);
          // create the new UserControl and set its context to the VM
          CustomTabItem newTab = new CustomTabItem() {
              Header = "New tab"
          };
          newTab.DataContext = fvm;
          MainWindowTabs.Items.Add(newTab);
      }
  </code></pre>
  
  <p>And in my <code>&lt;TabItem x:Class="MyProject.Views.CustomTabItem"</code> there is a label so bound: <code>&lt;Label Content="{Binding VMFancyObject.SomeList.Count}"/&gt;</code></p>
  
  <p>I expect to see the default count of the List created in the <code>FancyObject</code>'s constructor. However, after the new tab is created and added to the <code>dragablz:TabablzControl</code>, I just see a blank label. </p>
  
  <p>I also tried <code>&lt;Label DataContext="{Binding Path=DataContext.FancyTabViewModel,RelativeSource={RelativeSource AncestorType={x:Type TabItem}}}" Content="{Binding VMFancyObject.SomeList.Count}" HorizontalAlignment="Left" Margin="341,196,0,0" Foreground="Black" Background="#FF97FF02"/&gt;</code></p>