title: DataTemplate DataType usage WPF
body: <p>I had been setting the DataContext for UserControls like so:</p>
  
  <pre><code>&lt;uc:DepartmentListingView DataContext="{Binding ., Mode=TwoWay}" /&gt;
  </code></pre>
  
  <p>Based on a <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx" rel="nofollow noreferrer">sample project by Josh Smith</a> I am trying to accomplish the same thing with a DataTemplate and DataType:</p>
  
  <pre><code>&lt;!-- Template applies a DepartmentListingView to an instance of the DepartmentSelectionViewModel class. --&gt;
  &lt;DataTemplate DataType="{x:Type model:DepartmentSelectionViewModel}"&gt;
      &lt;uc:DepartmentListingView /&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>This works well, but of course there is a problem; I think it might arise from trying to set more than one view (UserControl) to the same view model(?). In the code below I am now associating the same viewModel from above with a different view in the same window.</p>
  
  <pre><code>&lt;DataTemplate DataType="{x:Type model:DepartmentSelectionViewModel}"&gt;
      &lt;uc:ListSubjectHeaderView /&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>The first view is wired the same as it was when I set the DataContext explicitly but the last view gets no binding, although no obvious DataBinding error in the console either.</p>
  
  <p>So, would resusing the DataType / DataTemplate trick this way be the problem?</p>
  
  <p>Thanks,<br>
  Berryl</p>