+1 vote
in C Sharp by
What is the difference between Margin and Padding properties in Xamarin?

1 Answer

0 votes
by
  • Margin property represents the distance between the element and its adjacent elements and is used to control the element's rendering position, and the rendering position of its neighbors. Margin can be specified on Layout and View classes.

  • Padding property represents the distance between an Element and the child elements of it and thus it is used to separate the control from its own content. Padding values can be specified on Layout classes.

  • Suppose, two adjacent elements have a margin of value 20 pixels assigned, what will be the distance between these two elements? Why?

    The distance between two elements will be 40 pixels in this case, because, Margin property values are Additive. In addition to this, if Margin and Padding both are applied, then the distance between element and its content will be Margin + Padding.

Related questions

0 votes
asked Aug 20, 2020 in C Sharp by Hodge
0 votes
+1 vote
asked Aug 20, 2020 in C Sharp by RShastri
...