title: Applying DataTemplate to a Grid
body: <p>How is a <code>DataTemplate</code> applied to a <code>Grid</code>?</p>
  
  <p>I have a <code>DataTemplate</code> named <em>DataGrid_Template</em> in my <code>Resources.xaml</code> file that I would like to apply to a <code>Grid</code> in <em>View.xaml</em>.</p>
  
  <p><br>
  <strong>Resources.xaml</strong></p>
  
  <pre><code>&lt;ResourceDictionary ... &gt;
      &lt;DataTemplate x:Key="DataGrid_Template"&gt;
          &lt;Grid&gt;
              &lt;Grid.RowDefinitions ... /&gt;
              &lt;DockPanel ... /&gt;
              &lt;DataGrid ... /&gt;
          &lt;/Grid&gt;
      &lt;/DataTemplate&gt;
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p><br>
  <strong>View.xaml</strong></p>
  
  <pre><code>&lt;UserControl ... &gt;
      &lt;Grid /&gt; &lt;!-- want to apply DataGrid_Template to this --&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p><br>
  I tried using the <code>Grid</code> <em>property</em> <code>TemplatedParent</code>, but that seems to be a read-only <em>property</em>.</p>