Margins

Margins define the space around a control, and for the most part, their use is fairly intuitive. The row and column combination determine the top and left location of the control, and the margins can then be used to adjust the position.

Figure 12 – Margins

In Figure 12, the three buttons are aligned TopLeft in the cell and flow down the page.

Button1 has 4 pixel margins defined for top, bottom, left and right. This has moved it 4 pixels down from the top of the row and as the buttons are flowing, Button2 has also moved down 4 more pixels. However, there are no margins visible to the left and right of Button1. As the button isn't sizing or flowing in anyway, the margins effectively cancel each other out.

Button2 is defined with the same 4 pixel margins all around, however, its sizing is defined as FitToWidth. In this scenario, both Left and Right margins are evaluated. The left margin moves the left edge to the right by 4 pixels and similarly, the right margin moves the right edge to the left by 4 pixels.

Button3 is defined almost identically, the only difference being that the right margin is now zero. In this case the button moves to the right by 4 pixels.