Label Padding

MarkMadlangbayanMarkMadlangbayan Mark MadlangbayanUSUniversity

Is it possible to add padding on a Label? If not, what's a workaround if I want some space between the text and the edge of the label?


Best Answer


  • MarkMadlangbayanMarkMadlangbayan Mark Madlangbayan USUniversity


  • ChrisChanChrisChan Chris Chan MYMember

    not really work, not all text is left align. it put into grid .:(

  • ThomasBurkhartThomasBurkhart Thomas Burkhart DEMember ✭✭✭✭

    You can add a Frame around the Label. It has Padding properties

  • NMackayNMackay Norman Mackay GBInsider, University ✭✭✭✭✭

    The latest pre-release of Forms includes margin support, worth investigating.


    Adding margin support is intended to allow users to reduce the overall depth of their layout hierarchies by allowing more complex layouts with fewer wrapping views.
    public Thickness Margin { get; set; }

  • OnurHazarOnurHazar Onur Hazar USUniversity ✭✭

    @LuckyDay Thanks, it works. Do we need to wrap up in <ContentView.Content> ?

  • JohnHardmanJohnHardman John Hardman GBUniversity ✭✭✭✭✭
    edited September 2016

    @onur.hazar - Whilst using ContentView used to be how this was done (without using a custom renderer anyway), it is now possible to use the Margin property on Label, which is more efficient than wrapping in a ContentView.

  • OnurHazarOnurHazar Onur Hazar USUniversity ✭✭

    @JohnHardman Thanks!

  • BhaurajBiradar.9064BhaurajBiradar.9064 Bhauraj Biradar USMember ✭✭
    edited June 16

    Try below too,

    internal class DemoLabelRenderer : LabelRenderer
    private UIEdgeInsets EdgeInsets { get; set; }

        public override void Draw(CGRect rect)
            EdgeInsets = new UIEdgeInsets(0, 2, 0, 2);


Sign In or Register to comment.