GradientStop GradientStop GradientStop Class

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

Syntax

Declaration

public sealed class GradientStoppublic sealed class GradientStopPublic NotInheritable Class GradientStop
<GradientStop .../>

Inheritance Hierarchy

Remarks

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 summary

Initializes a new instance of the GradientStop class.

Properties summary

Gets or sets the color of the gradient stop.

Identifies the Color dependency property.

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

Identifies the Offset dependency property.

Constructors

  • GradientStop()
    GradientStop()
    GradientStop()
    GradientStop()

    Initializes a new instance of the GradientStop class.

    public GradientStop()public New()Public Sub New()public 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 Colorpublic Color Color { get; set; }
    <GradientStop Color="colorString" .../>
    

    Property Value

    Remarks

    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 DependencyPropertypublic static DependencyProperty ColorProperty { get; }

    Property Value

  • 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 doublepublic double Offset { get; set; }
    <GradientStop Offset="double"/>
    

    Property Value

    • 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 DependencyPropertypublic static DependencyProperty OffsetProperty { get; }

    Property Value

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.UI.Xaml.Markup.ContentPropertyAttribute

Details

Assembly

Windows.UI.Xaml.Media.dll