title: How to change Resource Dictionary Color in the runtime
body: <p>In XAML:</p>
  
  <pre><code>&lt;ResourceDictionary&gt;
      &lt;Color x:Key="BrushColor1"&gt;Red&lt;/Color&gt;
      &lt;Color x:Key="BrushColor2"&gt;Black&lt;/Color&gt;
  
      &lt;LinearGradientBrush x:Key="GradientBrush1" StartPoint="0,0.5" EndPoint="1,0.5"&gt;
          &lt;GradientStop Color="{DynamicResource BrushColor2}" Offset="0" /&gt;
          &lt;GradientStop Color="{DynamicResource BrushColor1}" Offset="1" /&gt;
      &lt;/LinearGradientBrush&gt;
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>In C#:</p>
  
  <pre><code>    public void CreateTestRect()
      {
          Rectangle exampleRectangle = new Rectangle();
          exampleRectangle.Width = 150;
          exampleRectangle.Height = 150;
          exampleRectangle.StrokeThickness = 4;
          exampleRectangle.Margin = new Thickness(350);
  
          ResourceDictionary resources = this.Resources;
          resources["BrushColor1"] = Colors.Pink;
          resources["BrushColor2"] = Colors.RoyalBlue;
          Brush brush =(Brush)this.FindResource("GradientBrush1");
  
          exampleRectangle.Fill = brush;
          canvas.Children.Insert(0, exampleRectangle);
      }
  </code></pre>
  
  <p>How to change those Color elements in the runtime in C#. The LinearGradientBrush should get changed dynamically?</p>
  
  <p>I wish to do something like this:</p>
  
  <pre><code>(Color)(this.FindResource("BrushColor1")) = Colors.Pink;
  </code></pre>
  
  <p>but I failed.</p>