Line.X1 Property

Definition

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

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

Property Value

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

Attributes

Examples

The following example shows how to create a Line and then set the X1 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);

Remarks

Dependency Property Information

Identifier field X1Property
Metadata properties set to true AffectsMeasure, AffectsRender

Applies to

제품 버전
.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