GradientStop GradientStop GradientStop GradientStop Class

Definition

Describes the location and color of a transition point in a gradient.

public : sealed class GradientStop : DependencyObject, IGradientStoppublic sealed class GradientStop : DependencyObject, IGradientStopPublic NotInheritable Class GradientStop Inherits DependencyObject Implements IGradientStop// This API is not available in Javascript.
<GradientStop .../>
Inheritance
GradientStopGradientStopGradientStopGradientStop
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Inherited properties

Examples

This example creates a linear gradient with four colors and uses it 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>

Image of example results with gradient stops

Constructors

GradientStop() GradientStop() GradientStop() GradientStop()

Initializes a new instance of the GradientStop class.

public : GradientStop()public GradientStop()Public Sub New()// This API is not available in Javascript.

Properties

Color Color Color Color

Gets or sets the color of the gradient stop.

public : Color Color { get; set; }public Color Color { get; set; }Public ReadWrite Property Color As Color// This API is not available in Javascript.
<GradientStop Color="colorString" .../>
Value
Color Color Color 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>

ColorProperty ColorProperty ColorProperty ColorProperty

Identifies the Color dependency property.

public : static DependencyProperty ColorProperty { get; }public static DependencyProperty ColorProperty { get; }Public Static ReadOnly Property ColorProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Color dependency property.

Offset Offset Offset Offset

Gets the location of the gradient stop within the gradient vector.

public : double Offset { get; set; }public double Offset { get; set; }Public ReadWrite Property Offset As double// This API is not available in Javascript.
<GradientStop Offset="double"/>
Value
double double double double

The relative location of this gradient stop along the gradient vector. The default is 0.

OffsetProperty OffsetProperty OffsetProperty OffsetProperty

Identifies the Offset dependency property.

public : static DependencyProperty OffsetProperty { get; }public static DependencyProperty OffsetProperty { get; }Public Static ReadOnly Property OffsetProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Offset dependency property.