Export (0) Print
Expand All
Key
M11
M12
M21
M22
Tag
Uri
X1
X2
Y1
Y2
Expand Minimize

GradientStops (RadialGradientBrush)

Silverlight

Gets or sets the collection of gradient stops for a RadialGradientBrush object.

<RadialGradientBrush ...>
  oneOrMoreGradientStops
</RadialGradientBrush>
value = object.GradientStops
object.GradientStops = value

Value

Description

oneOrMoreGradientStops

One or more GradientStop object elements.

Type: GradientStopCollection

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 collection.

The XAML syntax for GradientStops is an example of an implicit collection syntax, where you can omit the GradientStopCollection object element and the <RadialGradientBrush.GradientStops> property element. Instead, you generally include one or more GradientStop object elements as child elements of a RadialGradientBrush. Explicitly including a GradientStopCollection object element is permissible in 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 RadialGradientBrush with three gradient stops in the implicit GradientStopCollection. The three gradient stops specify a brush with varying transparency, which is then applied as the OpacityMask for an Image.

<Canvas  
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 

  <Image Source="sampleImages/forest.jpg" Height="100">
    <Image.OpacityMask>
      <RadialGradientBrush Center="0.5,0.5">
        <!-- This gradient stop is partially transparent. -->
        <GradientStop Color="#00000000" Offset="1" />
        <!-- This gradient stop is partially transparent. -->
        <GradientStop Color="#20000000" Offset="0.8" />
        <!-- This gradient stop is fully opaque. -->
        <GradientStop Color="#FF000000" Offset="0" />
      </RadialGradientBrush>
    </Image.OpacityMask>
  </Image> 
</Canvas>

Community Additions

ADD
Show:
© 2014 Microsoft