Partager via


TextBlock.LineHeight Property

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

Gets or sets the height of each line of content.

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

Syntax

'Declaration
Public Property LineHeight As Double
public double LineHeight { get; set; }
<TextBlock LineHeight="double"/>

Property Value

Type: System.Double
The height of each line in pixels. A value of 0 indicates that the line height is determined automatically from the current font characteristics. The default is 0.

Exceptions

Exception Condition
ArgumentException

LineHeight is set to a non-positive value.

Remarks

Dependency property identifier field: LineHeightProperty

Changing this value does not change the height of the associated text. Instead, it changes the height of the line that contains the text. To change the size of the text, use the FontSize property.

The layout of lines in a TextBlock is affected by this property and by the LineStackingStrategy property. This property affects layout only when the LineStackingStrategy property is set to BlockLineHeight.

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.