Seeking rounded corners recipie for Xamarin.Forms, have one for Monotouch

IanGeogheganIanGeoghegan USUniversity ✭✭

In porting some iOS code I found on StackOverflow I was able to come up with the following code for rounded corners on labels:


headerLabel.Frame = new RectangleF( 0, this.ContentView.Frame.Top, this.ContentView.Frame.Width, this.ContentView.Frame.Height );
var leftShapeLayer = new CAShapeLayer();
leftShapeLayer.Path = UIBezierPath.FromRoundedRect( this.ContentView.Frame, 8f ).CGPath;
this.headerLabel.Layer.Mask = leftShapeLayer;
this.headerLabel.Layer.MasksToBounds = true;
this.headerLabel.Layer.ShouldRasterize = true;
this.headerLabel.Layer.RasterizationScale = UIScreen.MainScreen.Scale;

Does anyone know how to work this sort of magic on Labels and ContentViews?

Posts

Sign In or Register to comment.