Browse examples
The .NET Multi-platform App UI (.NET MAUI) Polygon class is derived from the Shape class and can be used to draw polygons, which are closed shapes formed by a series of connected lines. For information about the properties that the Polygon class inherits from the Shape class, see Shapes.
Polygon defines the following properties:
These properties are backed by BindableProperty objects; that is, they can be the target of data binding and can be styled.
The PointsCollection type is an ObservableCollection of Point objects. The Point structure defines X and Y properties of type double, which represent pairs of x and y coordinates in two-dimensional space. Therefore, the Points property should be set to a list of x- and y-coordinate pairs that describe the polygon's vertices, separated by a comma and/or one or more spaces. For example, "40,10 70,80" and "40 10, 70 80" are both valid.
For more information about the FillRule enumeration, see Fill Rules.
Create polygon
To draw a polygon, create a Polygon object and set its Points property to the shape's vertices. A line is automatically drawn connecting the first and last points. To draw inside a polygon, set its properties to a Brush-derived object. To outline a polygon, set its properties to a Brush derived object. Property specifies the thickness of the polygon outline. For more information about the Brush object, see Brushes.
The following XAML example demonstrates how to draw a filled polygon:
In this example, a filled polygon representing a triangle is drawn:
The following XAML example demonstrates how to draw a dashed polygon:
In this example, the polygon outline is dashed:
For more information on drawing dashed polygons, see.
The following XAML example shows a polygon using default fill rules:
In this example, the filling behavior of each polygon is determined using filling rules.

The following XAML example shows a polygon using fill rules:

In this example, the filling behavior of each polygon is determined using filling rules.





