title: Dynamically change gradientstop color
body: <p>I'm using a windows phone silverlight application, the default panorama template has a listbox with a static gradientstop property.</p>
  
  <pre><code>&lt;ListBox ItemsSource="{Binding lbox}" Name="listboxUsers" Margin="2,126,0,6" Grid.Column="1" Grid.ColumnSpan="2" Grid.RowSpan="2"&gt;
  &lt;SNIP&gt;
      &lt;Rectangle Height="100" Width="100" Margin="12,0,9,0" Name="Recta"&gt;
          &lt;Rectangle.Fill&gt;
              &lt;LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"&gt;
                  &lt;GradientStop Color="Gray" Offset="1"  /&gt;
              &lt;/LinearGradientBrush&gt;
          &lt;/Rectangle.Fill&gt;
        &lt;/Rectangle&gt;
  </code></pre>
  
  <p>I want to change the color property of the gradientstop dynamically , I tried to bind the Color property:</p>
  
  <pre><code>public class lbox   
  {
  
      public lbox(string par1, string par2, Color par4) 
      { 
          displayname = par1;
          state = par2;  
  
          gscolor = new GradientStop();
          gscolor.Color = par4;
      }
  
      public string displayname { get; set; }
      public string state { get; set; }
      public SolidColorBrush lbcolor { get; set; }
      private GradientStop gscolor { get; set; }
  }
  </code></pre>
  
  <p>XAML:</p>
  
  <pre><code>GradientStop Color="{Binding gscolor}" Offset="1"  /&gt;
  </code></pre>
  
  <p>However, this causes a XMLPaseException: AG_E_PARSER_BAD_PROPERTY_VALUE. I also tried to use a color  property without a new instance of Gradientstop in the code behind... Note that the binding is working correctly for string values.</p>
  
  <p>Anyone know what I'm doing wrong?</p>
  
  <p><strong>Edit:</strong>
  Matt pointed me in the right direction:</p>
  
  <pre><code>&lt;Rectangle Height="100" Width="100" Margin="12,0,9,0" Fill="{Binding lbcolor}"&gt;
  </code></pre>
  
  <p>In the code behind as seen above, lbcolor is a <code>SolidColorBrush</code>.</p>