TextBlock.MaxLines 属性

定义

获取或设置 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"/>

属性值

Int32

int

TextBlock 中显示的文本行数上限。 默认值为 0,这是表示“自动”行为的特殊值。 该值不能为负数。

注解

使用 MaxLines 属性可指定文本块中显示的文本的最大行数。 无论字号、字体样式或文本长度如何,文本控件都会调整其高度,使其显示不超过指定的行数。

负整数值无效,将导致运行时异常。

适用于