public GradientButton() { HeightRequest = 44; WidthRequest = 100; _label = new Label { Text = Text, TextColor = TextColor, FontSize = 17, BackgroundColor = Color.Transparent, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center }; _background = new NControlView { DrawingFunction = (canvas, rect) => { var brush = new LinearGradientBrush( Point.Zero, Point.OneX, StartColor.ToNColor(), EndColor.ToNColor()); var curveSize = BorderRadius; var width = rect.Width; var height = rect.Height; canvas.DrawPath(new PathOp[] { new MoveTo(curveSize, 0), // Top Right corner new LineTo(width - curveSize, 0), new CurveTo( new Point(width - curveSize, 0), new Point(width, 0), new Point(width, curveSize) ), new LineTo(width, height - curveSize), // Bottom right corner new CurveTo( new Point(width, height - curveSize), new Point(width, height), new Point(width - curveSize, height) ), new LineTo(curveSize, height), // Bottom left corner new CurveTo( new Point(curveSize, height), new Point(0, height), new Point(0, height - curveSize) ), new LineTo(0, curveSize), new CurveTo( new Point(0, curveSize), new Point(0, 0), new Point(curveSize, 0) ), new ClosePath() }, null, brush); } }; Content = new Grid { Children = { _background, _label } }; }