TableCell class represents a single cell in a Table. Cells are added to a TableRow instance in the rows collection of a table. The main purpose of the cell is to contain, organize and layout tabular data.

[C#] Example 2: Add content to TableCell

You can easily change the cell's presentation by using the following properties:

RowSpan: Defines the number or rows that the TableCell instance should occupy.

ColumnSpan: Defines the number of columns that the TableCell instance should occupy.

Padding: Specifies the distances between the cells borders inner contour and the cell content. If the value is null, the cell will use the padding from the table's DefaultCellProperties.

Borders: Specifies the borders of the cells. If the value is null the cell uses the value from table's DefaultCellProperties.

Background: Specifies the background of the cell. If null, the cell uses the background from table's DefaultCellProperties.

PreferredWidth: Specifies the preferred width of the cell. The final width of the cell may be bigger of the set value in case when another cell from the same column requires bigger PreferredWidth.

Example 3 demonstrates how to set locally the cell properties to a specific cell. This helps achieve different appearance for this cell by changing its borders and background. Additionally, the cell will span onto two rows and two columns.