Export (0) Print
Expand All

GradientStop.Color Property

Gets or sets the color of the gradient stop.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

public Color Color { get; set; }
<GradientStop Color="colorString" .../>

XAML Values

colorString

The Color for a SolidColorBrush expressed as an attribute string. This can be a named color, an RGB value, or an ScRGB value. RGB or ScRGB may also specify alpha information. For more information, see "XAML Attribute Usage" in Color.

Property Value

Type: System.Windows.Media.Color
The color of the gradient stop. The default is Transparent.

Dependency property identifier field: ColorProperty

You can set a color to a static property value of Colors, to additional named colors using string type conversion, or to a Color returned by methods such as FromArgb. For details, see Color.

The following 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>


Gradient stops in a linear gradient

Gradient with gradient stops.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft