1 out of 1 rated this helpful - Rate this topic

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
'Declaration
<TypeConverterAttribute(GetType(LengthConverter))> _
Public Property X2 As Double
<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 
Dim myLine As New Line()
myLine.Stroke = 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)

More Code

How to: Draw a LineThis example shows you how to draw lines by using the Line element.
How to: Animate a Property Without Using a StoryboardThis example shows one way to apply an animation to a property without using a Storyboard.

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.