Export (0) Print
Expand All

Table.CellSpacing Property

Gets or sets the amount of spacing between cells in a table. This is a dependency property.

Namespace:  System.Windows.Documents
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

[TypeConverterAttribute(typeof(LengthConverter))]
public double CellSpacing { get; set; }
<object property="double"/>
- or -
<object property="qualifiedDouble"/>

XAML Values

double

Double

String representation of a Double value equal to or greater than 0.0 but smaller than PositiveInfinity. An unqualified value is measured in device independent pixels. Strings need not explicitly include decimal points.

qualifiedDouble

A double value as described above, followed by one of the following unit specifiers: px, in, cm, pt.

px (default) is device-independent units (1/96th inch per unit)

in is inches; 1in==96px

cm is centimeters; 1cm==(96/2.54) px

pt is points; 1pt==(96/72) px

Property Value

Type: System.Double
The amount of spacing between cells in a table, in device independent pixels.
The default value is 2.0.

Identifier field

CellSpacingProperty

Metadata properties set to true

AffectsMeasure

The following example defines a simple 2 x 3 table with a CellSpacing of 0.35 centimeters.

<Table Background="Yellow" CellSpacing="0.35cm">
  <Table.Columns>
    <TableColumn /> <TableColumn /> <TableColumn />
  </Table.Columns>
  <TableRowGroup>
    <TableRow>
      <TableCell Background="Cyan">
        <Paragraph>Cell at Row 1 Column 1</Paragraph>
      </TableCell>
      <TableCell Background="Cyan">
        <Paragraph>Cell at Row 1 Column 2</Paragraph>
        <Paragraph>Cell at Row 1 Column 2</Paragraph>
      </TableCell>
      <TableCell Background="Cyan">
        <Paragraph>Cell at Row 1 Column 3</Paragraph>
      </TableCell>
    </TableRow>
    <TableRow>
      <TableCell Background="Cyan">
        <Paragraph>Cell at Row 2 Column 1</Paragraph>
      </TableCell>
      <TableCell Background="Cyan">
        <Paragraph>Cell at Row 2 Column 2</Paragraph>
      </TableCell>
      <TableCell Background="Cyan">
        <Paragraph>Cell at Row 2 Column 3</Paragraph>
      </TableCell>
    </TableRow>
  </TableRowGroup>
</Table>

The following figure shows how this example renders.

Screenshot: Table cell spacing

In contrast, the following figure shows how the same table renders with a default cell spacing of 2 pixels.

Screenshot: Table cell spacing

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0

Community Additions

ADD
Show:
© 2014 Microsoft