--- title: "How to: Draw a Line" ms.date: "03/30/2017" helpviewer_keywords: - "drawing [WPF], lines" - "graphics [WPF], lines" - "lines [WPF], drawing" ms.assetid: 0513ee01-6b27-4bb3-85f3-3a3e6710d80e --- # How to: Draw a Line This example shows you how to draw lines by using the element. To draw a line, create a element. Use its and properties to set its start point; and use its and properties to set its end point. Finally, set its and because a line without a stroke is invisible. Setting the element for a line has no effect, because a line has no interior. The following example draws three lines inside a element. ## Example [!code-xaml[drawingwithshapeelements#LineExample1](~/samples/snippets/csharp/VS_Snippets_Wpf/DrawingWithShapeElements/CS/lineexample.xaml#lineexample1)] This example is part of a larger sample; for the complete sample, see [Shape Elements Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Graphics/ShapeElements). ## See also - - [Shape Elements Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Graphics/ShapeElements)