แก้ไข

แชร์ผ่าน


Table.CellSpacing Property

Definition

Gets or sets the amount of spacing between cells in a table.

public:
 property double CellSpacing { double get(); void set(double value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))]
public double CellSpacing { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))>]
member this.CellSpacing : double with get, set
Public Property CellSpacing As Double

Property Value

The amount of spacing between cells in a table, in device independent pixels.

The default value is 2.0.

Attributes

Examples

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

Remarks

XAML Attribute Usage

<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

Dependency Property Information

Identifier field CellSpacingProperty
Metadata properties set to true AffectsMeasure

Applies to