--- title: "How to: Draw a Polyline by Using the Polyline Element" ms.date: "03/30/2017" helpviewer_keywords: - "connected lines [WPF]" - "polylines [WPF], drawing" - "graphics [WPF], polylines" - "lines [WPF], connected (see polylines)" - "drawing [WPF], polylines" ms.assetid: 65db8935-d047-4295-87c4-b427ff3ad293 --- # How to: Draw a Polyline by Using the Polyline Element This example shows how to draw a polyline, which is a series of connected lines, by using the element. To draw a polyline, create a element and use its property to specify the shape vertices. Finally, use the and properties to describe the polyline outline because a line without a stroke is invisible. > [!NOTE] > Because the element is not a closed shape, the property has no effect, even if you deliberately close the shape outline. To create a closed shape with a , use a element. The following example draws two elements inside a . ## Example In [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)], valid syntax for points is a space-delimited list of comma-separated x- and y-coordinate pairs. [!code-xaml[drawingwithshapeelements#PolylineExample1](~/samples/snippets/csharp/VS_Snippets_Wpf/DrawingWithShapeElements/CS/polylineexample.xaml#polylineexample1)] Although this example uses a to contain the polylines, you can use polyline elements (and all the other shape elements) with any or that supports non-text content. 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) - [Shapes and Basic Drawing in WPF Overview](shapes-and-basic-drawing-in-wpf-overview.md)