Export (0) Print
Expand All

TableCell::Padding Property

Gets or sets the padding thickness for the element.

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

property Thickness Padding {
	Thickness get ();
	void set (Thickness value);
    <Thickness .../>
<object Padding="uniformThickness"/>
- or -
<object Padding="independentThickness"/>
- or -
<object Padding="qualifiedUniformThickness"/>
- or -
<object Padding="qualifiedIndependentThickness"/>

XAML Values


String representation of a single Double value to apply uniformly to all four thickness dimensions. For example, a value of "10" is equivalent to a value of "10,10,10,10". An unqualified value is measured in device independent pixels. Strings need not explicitly include decimal points.


String representation of four ordered Double values corresponding to independent thickness dimensions for left, top, right, and bottom, in this order. The four values must be separated with commas; spaces are not allowed. For example, "5,10,15,20" results in 5 pixels of padding to the left of content, 10 pixels of padding above content, 15 pixels of padding to the right of content, and 20 pixels of padding below the content.


A value described by uniformThickness followed by one of the following unit specifiers: px, in.

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

in is inches; 1in==96px

For example, "1in" provides uniform padding of 1 inch in all directions.


A value described by independentThickness, with each independent value followed by one of the following unit specifiers: px, in.

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

in is inches; 1in==96px

For example, "1.5in,0.8in,1.5in,0.8in". Unit specifiers may be mixed or omitted from one or more values.

Property Value

Type: System.Windows::Thickness
A Thickness structure specifying the amount of padding to apply, in device independent pixels.
The default value is a uniform thickness of zero (0.0).

Identifier field


Metadata properties set to true


The following example shows how to set the Padding attribute of a Block element (Paragraph).

<FlowDocument Background="LightSlateGray" ColumnWidth="2000">
  <Section Background="DarkMagenta" Margin="0" Padding="0">
    <Paragraph Background="White">
      <Run>Default paragraph.</Run>
    <Paragraph Background="White">
      <Run>Default paragraph.</Run>
    <Paragraph Background="LightBlue" Margin="50">
      <Run>This paragraph has a magin of 50 pixels set, but no padding.</Run>
    <Paragraph Background="LightCoral" Padding="50">
      <Run>This paragraph has padding of 50 pixels set, but no margin.</Run>
    <Paragraph Background="LightGreen" Margin="50" Padding="50">
      <Run>This paragraph has both padding and margin set to 50 pixels.</Run>
    <Paragraph Background="White">
      <Run>Default paragraph.</Run>
    <Paragraph Background="White">
      <Run>Default paragraph.</Run>

The following figure shows how this example renders. Exaggerated thicknesses and colors are used for illustration.

Screenshot: Paragraphs with padding and margins

The following example shows how to set the Padding property programmatically.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

© 2014 Microsoft