GradientStops Property (LinearGradientBrush)

Gets or sets the collection of the brush's gradient stops.

<LinearGradientBrush ...>
value = object.GradientStops
object.GradientStops = value

XAML Values

oneOrMoreGradientStops One or more GradientStop object elements.

Property Value


A collection of the GradientStop objects associated with the brush, each of which specifies a color and an offset along the brush's gradient axis.

This property is read/write. The default value is an empty GradientStopCollection.


The XAML syntax for GradientStops is an example of an implicit collection syntax, where you can omit the GradientStopCollection object element, as well as the <object.GradientStops> property element. Instead, you generally include one or more GradientStop object elements as child elements of a LinearGradientBrush. For more information about XAML implicit collection syntax, see XAML Syntax Overview. (Explicitly including a GradientStopCollection object element is permissible XAML syntax, and might be useful if you intend to name the collection in XAML and manipulate its contents through script later.)

Generally a GradientStopCollection contains a minimum of two gradient stops.


The following example creates a LinearGradientBrush with four gradient stops in the implicit GradientStopCollection, which is used to paint a Rectangle.

  <!-- This rectangle is painted with a diagonal linear gradient. -->
  <Rectangle Width="200" Height="100">
      <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" />

Applies To


See Also

Silverlight Brushes Overview