LinearGradientBrush.EndPoint Property

Definition

Gets or sets the ending two-dimensional coordinates of the linear gradient.

C#
public System.Windows.Point EndPoint { get; set; }

Property Value

The ending two-dimensional coordinates of the linear gradient. The default is (1,1).

Remarks

A LinearGradientBrush paints a gradient along a line. The line's start and end points are defined by the StartPoint and EndPoint properties of the LinearGradientBrush.

The default linear gradient is diagonal. In the default, the StartPoint of a linear gradient is (0,0), the upper-left corner of the area being filled, and its EndPoint is (1,1), the lower-right corner of the area being filled. The colors in the resulting gradient are interpolated along the diagonal path.

The following image shows a diagonal gradient. The black 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 A diagonal linear gradient

Specifying Relative or Absolute Values

Note that the MappingMode property of a LinearGradientBrush determines whether its EndPoint is interpreted as a relative or absolute value. A MappingMode of RelativeToBoundingBox specifies that the EndPoint value is relative to the size of the painted area. A MappingMode of Absolute specifies that the EndPoint value is expressed in device independent pixels. By default, the MappingMode is set to RelativeToBoundingBox, making the EndPoint a relative value.

Dependency Property Information

Item Value
Identifier field EndPointProperty
Metadata properties set to true None

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also