GradientStop GradientStop GradientStop GradientStop Class

Definition

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

public : sealed class GradientStop : DependencyObject, IGradientStop
public sealed class GradientStop : DependencyObject, IGradientStop
Public NotInheritable Class GradientStop Inherits DependencyObject Implements IGradientStop
var gradientStop = new gradientStop();
<GradientStop .../>
Inheritance
GradientStopGradientStopGradientStopGradientStop
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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()
var gradientStop = new gradientStop();

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
var color = gradientStop.color;
gradientStop.color = color;
<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
var dependencyProperty = Windows.UI.Xaml.Media.GradientStop.colorProperty;
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
var double = gradientStop.offset;
gradientStop.offset = double;
<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
var dependencyProperty = Windows.UI.Xaml.Media.GradientStop.offsetProperty;
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Offset dependency property.

Dispatcher Dispatcher Dispatcher Dispatcher

Inherited from DependencyObject

Methods

ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

Inherited from DependencyObject

GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty) GetAnimationBaseValue(DependencyProperty)

Inherited from DependencyObject

GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

Inherited from DependencyObject

ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

Inherited from DependencyObject

RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback) RegisterPropertyChangedCallback(DependencyProperty,DependencyPropertyChangedCallback)

Inherited from DependencyObject

SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object) SetValue(DependencyProperty,Object)

Inherited from DependencyObject

UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64) UnregisterPropertyChangedCallback(DependencyProperty,Int64)

Inherited from DependencyObject