title: WPF change dynamicresource in codebehind
body: <p>The standard RadioButton does not support setting the color of the ellipse. So, I took a radiobutton template from this location as a basis for a custom RadioButton:
  <a href="http://msdn.microsoft.com/en-us/library/ms751600" rel="nofollow noreferrer">RadioButton Styles and Templates</a></p>
  
  <pre><code>&lt;Ellipse.Fill&gt;
  &lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1"&gt;
      &lt;LinearGradientBrush.GradientStops&gt;
          &lt;GradientStopCollection&gt;
              &lt;GradientStop Color="{DynamicResource ControlLightColor}" /&gt;
              &lt;GradientStop Color="{DynamicResource ControlMediumColor}" Offset="1.0" /&gt;
          &lt;/GradientStopCollection&gt;
      &lt;/LinearGradientBrush.GradientStops&gt;
  &lt;/LinearGradientBrush&gt;
  </code></pre>
  
  <p></p>
  
  <p>ControlLightColor and ControlMediumColor are defined as:</p>
  
  <pre><code>&lt;Color x:Key="ControlLightColor"&gt;#ffff9a&lt;/Color&gt;
  &lt;Color x:Key="ControlMediumColor"&gt;#ffff9a&lt;/Color&gt;
  </code></pre>
  
  <p>Which gives us a yellow-ish ellipse.</p>
  
  <p>How can I alter this color in the codebehind?</p>
  
  <p>Regards,</p>
  
  <p>Michel</p>