title: Using a StaticResource SolidColorBrush to define the Gradient Stop Colors
body: <p>I am creating some wpf resource dictionaries with all the styles for an application! I have a few <code>LinearGradientBrush</code>es, where the color is set directly in the L<code>inearGradientBrush</code> reference as <code>GradientStop</code>s. However, I want to have a predefined set of colors that I can use a a reference for each <code>GradientStop</code>, so that changing the color scheme for the application is a matter of changing the values of the <code>SolidColorBrush</code>es:</p>
  
  <pre><code>&lt;SolidColorBrush Color="#5A5A5A" x:Key="colorbrushMedium" /&gt; 
  &lt;SolidColorBrush Color="#222222" x:Key="colorbrushDark" /&gt;  
  
  
  &lt;LinearGradientBrush&gt;
      &lt;GradientStop Color="{StaticResource colorbrushMedium}"/&gt;
      &lt;GradientStop Color="{StaticResource colorbrushDark}" Offset="1"/&gt;
  &lt;/LinearGradientBrush&gt;
  </code></pre>
  
  <p>With the code example above, I am getting the following error: </p>
  
  <pre><code>Cannot convert the value in attribute 'Color' to object of type 'System.Windows.Media.Color'. '#5A5A5A' is not a valid value for property 'Color'.  
  </code></pre>
  
  <p>The line it refers to is the line where <code>&lt;GradientStop Color="{StaticResource colorbrushMedium}"/&gt;</code> is defined.</p>
  
  <p>Any ideas?</p>