How can I remember which order Margin properties are set?

Often you can stare at a margin property "10,20,30,40" in XAML and be slightly confused as to which is which property.  If I have to deal with a format over and over again I will come up with a trick to remember how to work with it.

My trick is to remembering Thickness/Margin is by saying "LTRB" as in "letter b".

Example: if we wanted to set the for a button margin like so:

Windows Forms
  button.Margin = new Margin(10, 20,30,40); // L,T,R,B

  button.Margin = new Thickness(10,20,30,40); // L,T,R,B
  <Button Margin="10,20,30,40"/> <!-- L, T, R, B -->

For completeness, this appears to be different than CSS, which is TRBL or (trouble).

margin:20px 30px 40px 10px;


Comments (1)

  1. reno says:

    I remember it by:  start left, and go clockwise

Skip to main content