TextBlock.Padding Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that indicates the thickness of padding space between the boundaries of the content area and the content displayed by a TextBlock.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property Padding As Thickness
public Thickness Padding { get; set; }
<TextBlock Padding="uniform"/>
- or -
<TextBlock Padding="left&Right,top&Bottom"/>
- or -
<TextBlock Padding="left,top,right,bottom"/>

XAML Values

NoteNote:

In the XAML syntax, you can use a space instead of a comma as the delimiter between values.

Property Value

Type: System.Windows.Thickness
A Thickness structure that specifies the amount of padding to apply.

Remarks

Dependency property identifier field: PaddingProperty

In XAML, Padding can be specified in the following ways:

  • As a single value that specifies uniform space in all directions (Padding="10").

  • As two values that specify horizontal and vertical dimensions (Padding="10,5").

  • As four values that represent left, top, right, and bottom padding independently (Padding="5,0,10,20").

For more information, see the Thickness class description.

If a specified padding thickness exceeds the corresponding content area dimension (for example, the sum of the left and right padding widths exceeds the content area width), the thickness of the padding is proportionally reduced to be no greater than the relevant content area dimension.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.