-
-
Save prashantvc/3a0ab3de9c21469661f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Xamarin.Forms.Platform.iOS; | |
using CoreGraphics; | |
using UIKit; | |
using Xamarin.Forms; | |
using FormsTestApp.iOS; | |
using FormsTestApp; | |
[assembly: ExportRenderer(typeof(CrossedOutLabel), typeof(CustomLabelRenderer))] | |
namespace FormsTestApp.iOS | |
{ | |
public class CustomLabelRenderer : LabelRenderer | |
{ | |
public override void Draw (CGRect rect) | |
{ | |
using (var context = UIGraphics.GetCurrentContext ()) { | |
ClearCanvas (context, rect); | |
DrawLine (context, rect); | |
} | |
} | |
static void ClearCanvas (CGContext context, CGRect rect) | |
{ | |
context.SetFillColor (Color.White.ToCGColor ()); | |
context.FillRect (rect); | |
} | |
void DrawLine (CGContext context, CGRect rect) | |
{ | |
var label = Element as CrossedOutLabel; | |
context.SetLineWidth (1); | |
context.SetStrokeColor (label.LineColor.ToCGColor ()); | |
context.SetFillColor (label.BackgroundColor.ToCGColor ()); | |
context.MoveTo (25, 15); | |
context.AddLineToPoint (100, -8); | |
context.DrawPath (CGPathDrawingMode.FillStroke); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment