Line.X2 Property
.NET Framework 3.5
Gets or sets the x-coordinate of the Line end point. This is a dependency property.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
The following example shows how to create a Line and then set the X2 property by using code. For the complete sample, see WPF Shapes Gallery Sample.
// 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);
More Code
| How to: Draw a Line | This example shows you how to draw lines by using the Line element. |
| How to: Animate a Property Without Using a Storyboard | This example shows one way to apply an animation to a property without using a Storyboard. |
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.