Positioning a control using Row, Column and Alignment

The combination of a row and column define a logical cell in which the control will be placed. The precise position within the cell depends primarily on the alignment, although there are other factors such as flow, span and margins that will be discussed later.

In Figure 6, 9 buttons have been placed in row 2, column 2, and each has been given a specific alignment. The result is that each button is positioned according to the requirements of its alignment, within the row and column combination.

Figure 6 – Alignments

Figure 7 shows exactly the same buttons, however the row and column sizes have been changed, so the Top and Left properties of the buttons have been modified so that they still follow the row and column boundaries.

Figure 7 - Alignments

This is the first fundamental purpose of a layout. Layouts dictate the value of the Top and Left properties of a control.

As seen, specifying a row and column defines a cell, but Table Layout also allows for a control to have either a row or a column, leaving the other as null. If only a row is specified, only the Top, Center or Bottom part of the alignment is evaluated. The horizontal component of the alignment is ignored. The result is that the left position of the control is effectively fixed and will never change regardless of how the container is resized. Similarly, if the column is specified but the row is null, only the Left, Center and Right are evaluated, while the vertical component of the alignment is ignored.