Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Line.X2 Property

Gets or sets the x-coordinate of the Line end point.

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

[TypeConverterAttribute(typeof(LengthConverter))]
public double X2 { get; set; }
<object X2="double" .../>

Property Value

Type: System.Double
The x-coordinate for the end point of the line. The default is 0.

Identifier field

X2Property

Metadata properties set to true

AffectsMeasure, AffectsRender

The following example shows how to create a Line and then set the X2 property by using code.


// Add a Line Element
myLine = new Line();
myLine.Stroke = System.Windows.Media.Brushes.LightSteelBlue;
myLine.X1 = 1;
myLine.X2 = 50;
myLine.Y1 = 1;
myLine.Y2 = 50;
myLine.HorizontalAlignment = HorizontalAlignment.Left;
myLine.VerticalAlignment = VerticalAlignment.Center;
myLine.StrokeThickness = 2;
myGrid.Children.Add(myLine);

.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