tags:

views:

88

answers:

1

I'm attempting to databind a gradient brush as a Rectangle fill. What do I need to do to get the commented-out binding to work? StartColor and EndColor are declared as System.Drawing.Color.

<Rectangle Width="100" Height="20">
  <Rectangle.Fill>
    <LinearGradientBrush>
      <GradientStop Offset="0" Color="Pink"/>
      <GradientStop Offset="1"  Color="Red"/>
      <!--<GradientStop Offset="0" Color="{Binding Path=StartColor}"/>-->
      <!--<GradientStop Offset="1" Color="{Binding Path=EndColor}" />-->
    </LinearGradientBrush>
  </Rectangle.Fill>
</Rectangle>
+1  A: 

The problem was using System.Drawing.Color rather than the proper System.Windows.Media.Color

Douglas