Skip to content

Instantly share code, notes, and snippets.

@manojkulkarni30
Last active March 5, 2018 03:50
Show Gist options
  • Save manojkulkarni30/d24c3c819448242dc3cefbaa63c2f5cb to your computer and use it in GitHub Desktop.
Save manojkulkarni30/d24c3c819448242dc3cefbaa63c2f5cb to your computer and use it in GitHub Desktop.
Custom Button With Line Wrap in Xamarin Forms
using RendererApp;
using RendererApp.iOS;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using UIKit;

[assembly: ExportRenderer(typeof(CustomButton), typeof(CustomButtonRenderer))]
namespace RendererApp.iOS
{
    public class CustomButtonRenderer : ButtonRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e)
        {
            base.OnElementChanged(e);
            if (Control != null)
            {
                Control.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap;
            }
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment