How do you draw a line on a Canvas in .NET MAUI?

Platform: .NET MAUI| Category: General

Lines can be drawn on an ICanvas using the DrawLine method, which requires four float arguments that represent the start and end points of a line.
The following example shows how to draw a line:

C#

canvas.StrokeColor = Colors.Red;
canvas.StrokeSize = 6;
canvas.DrawLine(10, 10, 90, 100);

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.