title: How can I access ResourceDictionary in wpf from C# code?
body: <p>I have a <code>DataTemplate</code> defined in a xaml file that I want to access via C# code.
  Can anyone please tell me how can I access it?
  I added a new <code>ResourceDictionary</code> file and its name is <b>Dictionary1.xaml</b>. 
    I have a data template such as:</p>
  
  <pre><code>&lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
      &lt;DataTemplate x:Key="mytemplate"&gt;
          &lt;TextBlock Text="Name:" Background="Blue"/&gt;
      &lt;/DataTemplate&gt;
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>not I have a <code>ListBox</code> called listBox1 and I want to assign it to it's <code>Itemtemplate</code> property
  but I'm not getting how can i do it?</p>