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

  • Question

  • User43424 posted

    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?

    Friday, June 13, 2014 12:25 AM

All replies

  • User39602 posted

    There is a great video on custom renderers that does just what you need: http://forums.xamarin.com/discussion/17792/video-on-making-custom-renderers

    Friday, June 13, 2014 12:22 PM
  • User43424 posted

    @rene_ruppert? Outstanding. Thank you René.

    Friday, June 13, 2014 6:04 PM