Gradient​Stop Gradient​Stop Gradient​Stop 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
<GradientStop .../>
Inheritance
GradientStopGradientStopGradientStop
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()

Initializes a new instance of the GradientStop class.

public : GradientStop()public GradientStop()Public Sub New()
Attributes

Properties

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
<GradientStop Color="colorString" .../>
Value
Color Color Color

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

Attributes

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

Identifies the Color dependency property.

public : static DependencyProperty ColorProperty { get; }public static DependencyProperty ColorProperty { get; }Public Static ReadOnly Property ColorProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Color dependency property.

Attributes

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
<GradientStop Offset="double"/>
Value
double double double

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

Attributes

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
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Offset dependency property.

Attributes