title: How to Create Custom WPF Style Library
body: <p>I'm trying to place my WPF styles in a separate library, but at a little lost as to how this is best achieved. This is what I've done thus far:</p>
  
  <ol>
  <li>Created a new Class Library project and added references
  <em>PresentationCore</em>, <em>PresentationFramework</em>, <em>System.Xaml</em> and <em>WindowsBase</em> </li>
  <li><p>Created file "MyStyles.xaml" in this class library project with the
  following content:</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;Style TargetType="Button" x:Key="MyButtonStyle"&gt;
          &lt;Setter Property="Background" Value="Transparent"/&gt;
      &lt;/Style&gt;
  &lt;/ResourceDictionary&gt;
  </code></pre></li>
  <li><p>Built the project.</p></li>
  <li><p>Created a new WPF application project, and referenced the library
  built above. </p></li>
  <li><p>In App.xaml attempted to reference the resource dictionary in the libarary as follows:</p>
  
  <pre><code>`&lt;ApplicationResources&gt;
  &lt;ResourceDictionary&gt;
      &lt;ResourceDictionary.MergedDictionaries&gt;
          &lt;ResourceDictionary Source="pack://application:,,,/MyCustomWpfStyles;component/MyStyles.xaml"/&gt;
      &lt;/ResourceDictionary.MergedDictionaries&gt;
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>`</p></li>
  <li><p>At this point VS intellisense is telling that an error occurred
  while finding the resource dictionary, although the application
  builds without problem.</p></li>
  <li><p>Even if I am able to load the resource dictionary, I'm not sure how
  to use it with a control, e.g., <code>&lt;Button Style="What goes here??" /&gt;</code></p></li>
  </ol>
  
  <p>Looked over the internet, but can't seem to find a good example of how to package styles up into separate dll. Any pointers?</p>