Table.CellSpacing 属性

定义

获取或设置表格中单元格之间的间距量。

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

属性值

表格中单元格之间的间距,以与设备无关的像素为单位。

默认值为 2.0

属性

示例

以下示例定义一个简单 2 x 3 表,其 CellSpacing 值为 0.35 厘米。

<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>

下图显示了此示例的呈现方式。

屏幕截图:表格单元格间距屏幕截图

相比之下,下图显示了同一个表如何呈现默认单元格间距为 2 像素。

屏幕截图:表格单元格间距屏幕截图

注解

XAML 属性用法

<object property="double"/>
- or -
<object property="qualifiedDouble"/>

XAML 值

Double

值的字符串表示形式 Double 等于或大于 0.0 ,但小于 PositiveInfinity。 不限定的值以与设备无关的像素进行度量。 字符串不需要显式包含小数点。

qualifiedDouble如上所述的双精度值,后跟以下单位说明符之一:px、、incmpt

px (默认值) 是独立于设备的单位(每单位 1/96 英寸)

in 为英寸;1in==96px

cm 为厘米;1cm==(96/2.54) px

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

Dependency 属性信息

项目 价值
标识符字段 CellSpacingProperty
元数据属性设置为 true AffectsMeasure

适用于