GradientStop.Color Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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.

Syntax

Public Property Color As Color
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.

Remarks

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.

Examples

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

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

GradientStop Class

System.Windows.Media Namespace

LinearGradientBrush

RadialGradientBrush

Colors