Condividi tramite


LinearGradientBrush.StartPoint Property

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

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

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property StartPoint As Point
public Point StartPoint { get; set; }
<LinearGradientBrush StartPoint="x,y"/>

XAML Values

  • x
    The X value of the Point that specifies the gradient end point.

  • y
    The Y value of a Point that specifies the gradient end point.

Property Value

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

Remarks

Dependency property identifier field: StartPointProperty

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, and the default mode for the gradient coordinate system is RelativeToBoundingBox. When the mapping mode is RelativeToBoundingBox, StartPoint and EndPoint are "logical points", where values between 0 and 1 are mapped against the total size of the eventual bounding box where the brush is applied . With these defaults, the StartPoint of a linear gradient is the upper-left corner of the area being painted, a Point with value 0,0. Its EndPoint is the lower-right corner of the area being painted, a Point with value 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

Shows a gradient axis.

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

Gradient stops in a linear gradient

Gradient with gradient stops.

The XAML syntax for this property specifies a new Point as a string. The delimiter between the x and y values of the point can be either a comma or a space. Note that the comma usage has potential to clash with the usage of comma as the decimal point in some UI cultures. For more information, see the "XAML Attribute Syntax" section of Point. Also read Remarks in this topic regarding whether EndPoint should be given as a coordinate space point or a logical point.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.