GradientStop GradientStop GradientStop GradientStop Class

Definition

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

public : sealed class GradientStop : DependencyObject, IGradientStop
struct winrt::Windows::UI::Xaml::Media::GradientStop : DependencyObject, IGradientStop
public sealed class GradientStop : DependencyObject, IGradientStop
Public NotInheritable Class GradientStop Inherits DependencyObject Implements IGradientStop
<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()
GradientStop() const;
public GradientStop()
Public Sub New()

Properties

Color Color Color Color

Gets or sets the color of the gradient stop.

public : Color Color { get; set; }
Color Color(); void Color(Color color);
public Color Color { get; set; }
Public ReadWrite Property Color As Color
<GradientStop Color="colorString" .../>
Value
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; }
static DependencyProperty ColorProperty();
public static DependencyProperty ColorProperty { get; }
Public Static ReadOnly Property ColorProperty As DependencyProperty
Value
DependencyProperty DependencyProperty

The identifier for the Color dependency property.

Dispatcher Dispatcher Dispatcher Dispatcher

Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread.

(Inherited from DependencyObject)

Offset Offset Offset Offset

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

public : double Offset { get; set; }
double Offset(); void Offset(double offset);
public double Offset { get; set; }
Public ReadWrite Property Offset As double
<GradientStop Offset="double"/>
Value
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; }
static DependencyProperty OffsetProperty();
public static DependencyProperty OffsetProperty { get; }
Public Static ReadOnly Property OffsetProperty As DependencyProperty
Value
DependencyProperty DependencyProperty

The identifier for the Offset dependency property.

Methods

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

Clears the local value of a dependency property.

(Inherited from DependencyObject)

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

Returns any base value established for a dependency property, which would apply in cases where an animation is not active.

(Inherited from DependencyObject)

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

Returns the current effective value of a dependency property from a DependencyObject.

(Inherited from DependencyObject)

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

Returns the local value of a dependency property, if a local value is set.

(Inherited from DependencyObject)

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

Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance.

(Inherited from DependencyObject)

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

Sets the local value of a dependency property on a DependencyObject.

(Inherited from DependencyObject)

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

Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback.

(Inherited from DependencyObject)