GradientStop class

Applies to Windows and Windows Phone

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

Inheritance

Object
  DependencyObject
    GradientStop

Syntax


public sealed class GradientStop : DependencyObject


<GradientStop .../>

Attributes

[ContentProperty("")]
[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Members

The GradientStop class has these types of members:

Constructors

The GradientStop class has these constructors.

ConstructorDescription
GradientStop Initializes a new instance of the GradientStop class.

 

Methods

The GradientStop class has these methods. It also inherits methods from the Object class.

MethodDescription
ClearValue Clears the local value of a dependency property. (Inherited from DependencyObject)
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject)
ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject)
SetValue Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject)

 

Properties

The GradientStop class has these properties.

PropertyAccess typeDescription

Color

Read/writeGets or sets the color of the gradient stop.

ColorProperty

Read-onlyIdentifies the Color dependency property.

Dispatcher

Read-onlyGets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject)

Offset

Read/writeGets the location of the gradient stop within the gradient vector.

OffsetProperty

Read-onlyIdentifies the Offset dependency property.

 

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>


This illustration shows the results of the example, with the highlighted gradient stops.

Image of example results with gradient stops

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Media
Windows::UI::Xaml::Media [C++]

Metadata

Windows.winmd

See also

DependencyObject

 

 

Show:
© 2014 Microsoft