Export (0) Print
Expand All

LinearGradientBrush.StartPoint Property

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

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public Point StartPoint { get; set; }
<object>
  <object.StartPoint>
    <Point .../>
  </object.StartPoint>
</object>
<object StartPoint="Point" .../>

Property Value

Type: System.Windows.Point
The starting two-dimensional coordinates for the linear gradient. The default is (0, 0).

Identifier field

StartPointProperty

Metadata properties set to true

None

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.

A diagonal linear gradient

Gradient axis for a diagonal linear gradient

Specifying Relative or Absolute Values

Note that the MappingMode property of a LinearGradientBrush determines whether its StartPoint 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 StartPoint value is expressed in device independent pixels. By default, the MappingMode is set to RelativeToBoundingBox, making the StartPoint a relative value.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft