TextBlock.MaxLines Property

Definition

Gets or sets the maximum number of lines of text shown in the TextBlock.

public:
 property int MaxLines { int get(); void set(int value); };
int MaxLines();

void MaxLines(int value);
public int MaxLines { get; set; }
var int32 = textBlock.maxLines;
textBlock.maxLines = int32;
Public Property MaxLines As Integer
<TextBlock MaxLines="int"/>

Property Value

Int32

int

The maximum number of lines of text shown in the TextBlock. The default is 0, which is a special value that represents "Auto" behavior. The value cannot be negative.

Remarks

Use the MaxLines property to specify the maximum number of lines of text shown in a text block. The text control will adjust its height to show no more than the specified number of lines, regardless of the font size, font style, or text length.

Negative integer values are invalid, and will cause a run-time exception.

Applies to