GradientStop.Color Property

July 28, 2014

Gets or sets the color of the gradient stop.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public Color Color { get; set; }
<GradientStop Color="colorString" .../>

XAML Values

colorString

The Color for a SolidColorBrush expressed as an attribute string. This can be a named color, an RGB value, or an ScRGB value. RGB or ScRGB may also specify alpha information. For more information, see "XAML Attribute Usage" in Color.

Property Value

Type: System.Windows.Media.Color
The color of the gradient stop. The default is Transparent.

Dependency property identifier field: ColorProperty

You can set a color to a static property value of Colors, to additional named colors using string type conversion, or to a Color returned by methods such as FromArgb. For details, see Color.

The following example creates a LinearGradientBrush with four gradient stops in the implicit GradientStopCollection, which is used to paint a Rectangle.


<StackPanel>
  <!-- This rectangle is painted with a diagonal linear gradient. -->
  <Rectangle Width="200" Height="100">
    <Rectangle.Fill>
      <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="Yellow" Offset="0.0" />
        <GradientStop Color="Red" Offset="0.25" />
        <GradientStop Color="Blue" Offset="0.75" />
        <GradientStop Color="LimeGreen" Offset="1.0" />
      </LinearGradientBrush>
    </Rectangle.Fill>
  </Rectangle>
</StackPanel>


Gradient stops in a linear gradient

Gradient with gradient stops.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft