Line.X2 Property

Definition

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

C#
[System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))]
public double X2 { get; set; }

Property Value

The x-coordinate for the end point of the line. The default is 0.

Attributes

Examples

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

C#

// 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);

Remarks

Dependency Property Information

Item Value
Identifier field X2Property
Metadata properties set to true AffectsMeasure, AffectsRender

Applies to

Produto Versões
.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