title: Why does styles don't work at runtime in wpf, when using multiple MergedDictionaries?
body: <p>If i use MergedDictionaries multiple times to define styles, it doesn't work at runtime, but in WPF Designer of VS2010 it works. It also work if load MergedDictionaries using code at runtime.</p>
  
  <p>Why this is happening ? Is it my problem only or ? And how to solve it ?</p>
  
  <pre><code>I am using WPF4 and loading themes/styles from an assembly at application level.
  </code></pre>
  
  <p><em><strong>Not working</em></strong></p>
  
  <pre><code>&lt;!--Application.xaml--&gt;
   &lt;Application.Resources&gt;
      &lt;ResourceDictionary&gt;
          &lt;ResourceDictionary.MergedDictionaries&gt;
              &lt;ResourceDictionary Source="pack://application:,,,/Lib;component/Themes/Theme.xaml" /&gt;
          &lt;/ResourceDictionary.MergedDictionaries&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/Application.Resources&gt;
  
  
  &lt;!--Theme.xaml--&gt;
  &lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  &lt;ResourceDictionary.MergedDictionaries&gt;
      &lt;ResourceDictionary Source="Theme/Shared.xaml" /&gt;
      &lt;ResourceDictionary Source="Theme/Button.xaml" /&gt;
  &lt;/ResourceDictionary.MergedDictionaries&gt;
  </code></pre>
  
  <p></p>
  
  <p><em><strong>Working</em></strong></p>
  
  <pre><code>&lt;Application.Resources&gt;
          &lt;ResourceDictionary&gt;
              &lt;ResourceDictionary.MergedDictionaries&gt;
                  &lt;ResourceDictionary Source="pack://application:,,,/Lib;component/Themes/Theme/Shared.xaml" /&gt;
                  &lt;ResourceDictionary Source="pack://application:,,,/Lib;component/Themes/Theme/Button.xaml" /&gt;
              &lt;/ResourceDictionary.MergedDictionaries&gt;
          &lt;/ResourceDictionary&gt;
      &lt;/Application.Resources&gt;
  </code></pre>