Udostępnij za pośrednictwem


EndPoint (LinearGradientBrush)

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

Gets or sets the two-dimensional coordinates for the end point of the linear gradient axis.

<object EndPoint="Point"  .../>
value = object.EndPoint
object.EndPoint = value

Property Value

Type: Point

The two-dimensional coordinates for the end point of the linear gradient.

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

Managed Equivalent

EndPoint

Remarks

See the "Remarks" section in the Point reference topic for scripting usages of this property.

A LinearGradientBrush object paints an area with a linear gradient. A linear gradient defines a gradient along a line. The line's end points are defined by the StartPoint and EndPoint properties of the linear gradient. The LinearGradientBrush paints its GradientStops along this line.

The default linear gradient is diagonal, and the default mode for the gradient coordinate system is RelativeToBoundingBox. With these defaults, the StartPoint of a linear gradient is 0,0, which is the upper-left corner of the area that is being painted. Its EndPoint is 1,1, which is the lower-right corner of the area that is being painted. The colors in the resulting gradient are interpolated and applied along vectors that parallel this diagonal axis.

The following illustration shows a diagonal gradient. A line was added to highlight the interpolation path of the gradient from the start point to the end point.

Gradient axis for a diagonal linear gradient

Shows a gradient axis.

The following illustration shows the same linear gradient with highlighted gradient stops.

Gradient stops in a linear gradient

Gradient with gradient stops.

The MappingMode property of a LinearGradientBrush determines whether its EndPoint is interpreted as a relative or absolute value. By default, MappingMode is RelativeToBoundingBox, which treats the EndPoint value as relative. A MappingMode of Absolute specifies that the EndPoint value will be expressed in device-independent pixels. If you use Absolute mode, you will almost certainly also want to change the EndPoint, because a value of 1,1 versus a StartPoint of 0,0 would apply the brush only to a single pixel.

Applies To

LinearGradientBrush

See Also

Reference