Share via


GradientOrigin Property

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

XAML
<object GradientOrigin="Point" .../>
Scripting
value = object.GradientOrigin
object.GradientOrigin = value

Property Value

Point

The location of the two-dimensional focal point of the gradient.

This property is read/write. The default value is a point with value 0.5,0.5.

Remarks

See remarks in Point for scripting usages of this property.

Specifying Relative or Absolute Values

The MappingMode property of a RadialGradientBrush determines whether its coordinate properties are interpreted as a relative or absolute value. By default, GradientOrigin is treated as relative, which corresponds to a MappingMode of RelativeToBoundingBox. A MappingMode of Absolute specifies that the GradientOrigin value is expressed in device independent pixels, not as a factor within the bounding box of the area where the brush is applied.

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 3-D effects from out of 2-D objects.

Applies To

RadialGradientBrush

See Also

Silverlight Brushes Overview
LinearGradientBrush