PaddingStart/PaddingEnd vs PaddingLeft/PaddingRight: Which One Should I Use?

Nathan Sokalski 4,116 Reputation points
2021-05-02T16:33:45.18+00:00

PaddingStart & PaddingEnd seem to serve the same purpose as PaddingLeft & PaddingRight. Is there a difference between the two? In my case, I am using them with a TextView. At the moment, I have my code working with PaddingStart & PaddingEnd, but it sometimes worries me as to whether there may be a scenario in the future where they do not do the same thing. Also, I want to make sure I am consistent in which one I use. If I use PaddingStart & PaddingEnd, will a value be assigned to PaddingLeft & PaddingRight (and vice versa)? What happens if I assign values to both? I know that the values for PaddingStart & PaddingEnd are affected by the RTL settings (which I never use). I am also aware of PaddingHorizontal. All these different ways of specifying values that sound the same is sometimes confusing. My 2 main questions are:
Does assigning values to one affect the values of the others?
Which one takes priority if values are assigned to both?
If anyone knows of any good tutorials or blogs on the comparison of these properties, I would like to know about it. Thanks.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,293 questions
0 comments No comments
{count} votes

Accepted answer
  1. JarvanZhang 23,936 Reputation points
    2021-05-03T06:47:48.16+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Which one takes priority if values are assigned to both?

    The value of PaddingStart & PaddingEnd will take precedence over PaddingLeft & PaddingRight.

    Does assigning values to one affect the values of the others?

    PaddingLeft property are used to set the left/right padding of this view, PaddingStart is not only suitable for left padding. The device has LTR and RTL modes. If the user is in a locale that writes from right to left (RTL), then PaddingStart will be applied on the right side, while if they're in a left-to-right (LTR) locale (such as English), it will be applied on the left side. PaddingStart will always be applied on the left, regardless of the locale's text direction.

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful