Polygon
Basic example
View.Polygon(
points = Points.fromString "40,10 70,80 10,50",
fill = View.SolidColorBrush(Color.Black),
stroke = View.SolidColorBrush(Color.Orange),
strokeThickness = 5.
)
Basic example with styling
View.Polygon(
horizontalOptions = style.Position,
verticalOptions = style.Position,
backgroundColor = style.ViewColor,
margin = style.Thickness,
points = Points.fromString "40,10 70,80 10,50",
fill = View.SolidColorBrush(Color.Black),
stroke = View.SolidColorBrush(Color.Orange),
strokeThickness = 5.
)
See also:
More examples
Polygon
can be used to draw polygons, which are connected series of lines that form closed shapes.
let polygonPoints1 = "40,10 70,80 10,50"
let polygonPoints2 = "0 48, 0 144, 96 150, 100 0, 192 0, 192 96, 50 96, 48 192, 150 200 144 48"
// Polygon"
View.Polygon(
points = Points.fromString polygonPoints1,
fill = View.SolidColorBrush(Color.AliceBlue),
stroke = View.SolidColorBrush(Color.Green),
strokeThickness = 5.
)
// Polygon with dashed stroke
View.Polygon(
points = Points.fromString polygonPoints1,
fill = View.SolidColorBrush(Color.AliceBlue),
stroke = View.SolidColorBrush(Color.Green),
strokeThickness = 5.,
strokeDashArray = [ 1.; 1. ],
strokeDashOffset = 6.
)
// EvenOdd polygon
View.Polygon(
points = Points.fromString polygonPoints2,
fill = View.SolidColorBrush(Color.Blue),
fillRule = Shapes.FillRule.EvenOdd,
stroke = View.SolidColorBrush(Color.Red),
strokeThickness = 3.
)
// NonZero polygon
View.Polygon(
points = Points.fromString polygonPoints2,
fill = View.SolidColorBrush(Color.Black),
fillRule = Shapes.FillRule.Nonzero,
stroke = View.SolidColorBrush(Color.Yellow),
strokeThickness = 3.
)