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 屬性可指定文字塊中顯示的文字行數上限。 不論字型大小、字型樣式或文字長度為何,文字控件都會調整其高度,以顯示不超過指定的行數。

負整數值無效,而且會導致運行時間例外狀況。

適用於