EndPoint Property (LinearGradientBrush)
Gets or sets the ending two-dimensional coordinate point of the linear gradient axis.
XAML |
<object EndPoint="Point" .../>
|
Scripting |
value = object.EndPoint object.EndPoint = value |
Property Value
The ending two-dimensional coordinates of the linear gradient.
This property is read/write. The default value is a point with value 1,1.
Remarks
See remarks in Point for scripting usages of this property.
A LinearGradientBrush 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. A LinearGradientBrush brush 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 the upper-left corner of the area being painted, 0,0. Its EndPoint is the lower-right corner of the area being painted, 1.1. 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
The following illustration shows the same linear gradient, but with highlighted gradient stops.
Gradient stops in a linear gradient
Specifying Relative or Absolute Values
The MappingMode Property property of a LinearGradientBrush determines whether its EndPoint is interpreted as a relative or absolute value. By default, it is treated as relative, which corresponds to a MappingMode of RelativeToBoundingBox. A MappingMode of Absolute specifies that the EndPoint value is 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 only apply the brush to a single pixel.