Line
Basic example
View.Line(
stroke = View.SolidColorBrush(Color.Black),
x1 = 40.,
y1 = 0.,
x2 = 0.,
y2 = 120.
)
Basic example with styling
View.Line(
horizontalOptions = style.Position,
verticalOptions = style.Position,
backgroundColor = style.ViewColor,
stroke = View.SolidColorBrush(Color.Black),
x1 = 40.,
y1 = 0.,
x2 = 0.,
y2 = 120.
)
See also:
More examples
Line
can be used to draw lines.
// Line
View.Line(
x1 = 40.,
y1 = 0.,
x2 = 0.,
y2 = 120.,
stroke = View.SolidColorBrush(Color.Red)
)
// Line with stroke
View.Line(
x1 = 40.,
y1 = 0.,
x2 = 0.,
y2 = 120.,
stroke = View.SolidColorBrush(Color.DarkBlue),
strokeThickness = 4.
)
// Dashed line
View.Line(
x1 = 40.,
y1 = 0.,
x2 = 0.,
y2 = 120.,
stroke = View.SolidColorBrush(Color.DarkBlue),
strokeDashArray = [ 1.; 1. ],
strokeDashOffset = 6.
)
// LineCap: Flat
View.Line(
x1 = 0.,
y1 = 20.,
x2 = 300.,
y2 = 20.,
stroke = View.SolidColorBrush(Color.Red),
strokeThickness = 12.,
strokeLineCap = Shapes.PenLineCap.Flat
)
// LineCap: Square
View.Line(
x1 = 0.,
y1 = 20.,
x2 = 300.,
y2 = 20.,
stroke = View.SolidColorBrush(Color.Red),
strokeThickness = 12.,
strokeLineCap = Shapes.PenLineCap.Square
)
// LineCap: Round
View.Line(
x1 = 0.,
y1 = 20.,
x2 = 300.,
y2 = 20.,
stroke = View.SolidColorBrush(Color.Red),
strokeThickness = 12.,
strokeLineCap = Shapes.PenLineCap.Round
)