private void Canvas_PaintSurface(object sender, SKPaintSurfaceEventArgs args) { SKImageInfo info = args.Info; SKSurface surface = args.Surface; SKCanvas canvas = surface.Canvas; canvas.Clear(); SKPaint paint = new SKPaint { Style = SKPaintStyle.Stroke, Color = LineColor.ToSKColor(), StrokeWidth = HeightRequest > 0 ? (float)HeightRequest : (float)WidthRequest, StrokeCap = SKStrokeCap.Butt, PathEffect = SKPathEffect.CreateDash(new float[] { DashSize, WhiteSize }, Phase) }; SKPath path = new SKPath(); if (HeightRequest > 0) { // Horizontal path.MoveTo(0, 0); path.LineTo(info.Width, 0); } else { // Vertikal path.MoveTo(0, 0); path.LineTo(0, info.Height); } canvas.DrawPath(path, paint); }