RadialGradientBrush.GradientOrigin Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the location of the focal point that defines the beginning of the gradient.

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

Syntax

'Declaration
Public Property GradientOrigin As Point
public Point GradientOrigin { get; set; }
<RadialGradientBrush GradientOrigin="x,y"/>

XAML Values

  • x
    The X value of the Point that specifies the brush center.

  • y
    The Y value of a Point that specifies the brush center.

Property Value

Type: System.Windows.Point
The two-dimensional point located at the center of the radial gradient. The default value is a Point with value 0.5,0.5.

Remarks

Dependency property identifier field: GradientOriginProperty

When the mapping mode is RelativeToBoundingBox (the default), Center and GradientOrigin are "logical points", where values between 0 and 1 are mapped against the total size of the eventual bounding box where the brush is applied, and so the 0.5,0.5 value sets the center and gradient origin to the logical center of the bounding box. If the mapping mode is Absolute, then GradientOrigin should be given as a true point value in the coordinate system.

When GradientOrigin and Center are the same, this can be used to create the illusion/effect of a specular highlight from a "straight-on" lighting source applied to the object where the brush is used. By contrast, when GradientOrigin and Center are offset, this can create the illusion/effect of a specular highlight from an "off-center" lighting source. This technique is very useful for creating three-dimensional effects from two-dimensional objects. For more information about how to use GradientOrigin and Center for a RadialGradientBrush, see Brushes.

The XAML syntax for this property specifies a new Point as a string. The delimiter between the x and y values of the point can be either a comma or a space. Note that the comma usage has potential to clash with the usage of comma as the decimal point in some UI cultures. For more information, see the "XAML Attribute Syntax" section of Point. Also read Remarks in this topic regarding whether GradientOrigin should be given as a coordinate space point or a logical point.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

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

Platforms

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