GradientStop.Color Property

Definition

Gets or sets the color of the gradient stop.

Equivalent WinUI property: Microsoft.UI.Xaml.Media.GradientStop.Color.

public:
 property Color Color { Color get(); void set(Color value); };
Color Color();

void Color(Color value);
public Color Color { get; set; }
var color = gradientStop.color;
gradientStop.color = color;
Public Property Color As Color
<GradientStop Color="colorString" .../>

Property Value

Color

The color of the gradient stop. The default is Transparent.

Examples

This 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>

Applies to