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>
The problem was using System.Drawing.Color rather than the proper System.Windows.Media.Color
精彩评论