title: Proper usage of Merged Resource Dictionaries in Silverlight 3
body: <p>As I read: <a href="http://msdn.microsoft.com/en-us/library/cc903952(VS.95).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc903952(VS.95).aspx</a>, specifically the section labeled "Forward References With a ResourceDictionary":</p>
  
  <blockquote>
    <p>Static resource references from within
    any given resource dictionary must
    reference a resource that has already
    been defined lexically before the
    resource reference. Forward references
    cannot be resolved by a static
    resource reference. For this reason,
    if you use static resource references,
    you must design your resource
    dictionary structure such that
    resources intended for further
    by-resource use are defined at or near
    the beginning of each respective
    resource dictionary.</p>
  </blockquote>
  
  <p>Does this mean that I cannot do something like this in my App.xaml:</p>
  
  <pre><code>&lt;Application.Resources&gt;
      &lt;ResourceDictionary&gt;
          &lt;ResourceDictionary.MergedDictionaries&gt;
              &lt;ResourceDictionary Source="Assets/Colors.xaml"/&gt;
              &lt;ResourceDictionary Source="Assets/Brushes.xaml"/&gt;
          &lt;/ResourceDictionary.MergedDictionaries&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/Application.Resources&gt;
  </code></pre>
  
  <p>Where Brushes.xaml contains SolidColorBrush, LinearColorBrush, etc, definitions that refer to the colors defined in Colors.xaml ?</p>
  
  <p>e.g. </p>
  
  <pre><code>&lt;SolidColorBrush x:Key="OrangeRedBrush" Color="{StaticResource AppOrangeRed}"/&gt;
  </code></pre>
  
  <p>?</p>
  
  <p>I define my colors in Colors.xaml like:</p>
  
  <pre><code>&lt;Color x:Key="AppOrangeRed"&gt;#FFBF3C1F&lt;/Color&gt;
  </code></pre>
  
  <p>I'm getting a runtime error that states it cannot find a resource with key 'AppOrangeRed' for instance. </p>
  
  <p>What are the best practices for organizing Colors and Brushes so they can be reused (where appropriate, and I understand that colors are structs and brushes are reference objects, explained in <a href="http://weblogs.manas.com.ar/spalladino/2009/03/02/silverlight-xaml-guidelines/" rel="nofollow noreferrer">http://weblogs.manas.com.ar/spalladino/2009/03/02/silverlight-xaml-guidelines/</a>)</p>
  
  <p>Thanks
  Rob</p>