TextBlock.TextDecorations 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定 a TextDecorationCollection ,包含可應用於 文本 TextBlock的效果。
public:
property System::Windows::TextDecorationCollection ^ TextDecorations { System::Windows::TextDecorationCollection ^ get(); void set(System::Windows::TextDecorationCollection ^ value); };
public System.Windows.TextDecorationCollection TextDecorations { get; set; }
member this.TextDecorations : System.Windows.TextDecorationCollection with get, set
Public Property TextDecorations As TextDecorationCollection
屬性值
一個 TextDecorationCollection 包含可用於此元素的文字裝飾的收藏。 預設是 null (未施加文字裝飾)。
範例
以下範例說明如何設定屬性 TextDecorations 。
<TextBlock TextDecorations="Strikethrough">
This text will render with the strikethrough effect.
</TextBlock>
下圖顯示此範例的轉譯方式。
以下圖表分別展示了 、 OverLine和 Baseline 裝飾的渲染方式Underline。
下列示範如何以程式設計的方式設定 Typography 屬性。
TextBlock textBlock = new TextBlock(new Run("This text will render with the strikethrough effect."));
textBlock.TextDecorations = TextDecorations.Strikethrough;
Dim textBlock As New TextBlock(New Run("This text will render with the strikethrough effect."))
textBlock.TextDecorations = TextDecorations.Strikethrough
備註
物件 TextDecoration 是你可以加在文字上的視覺裝飾。 文字裝飾有四種類型:底線、底線、劃線和上線。 欲了解更多關於文字裝飾的資訊,請參閱 「如何製作文字裝飾」。
預設情況下,這個屬性會被設定為 , null 且沒有 TextDecorationCollection 相關關聯。 在新增任何文字特效前,先建立一個新的 TextDecorationCollection 並指派到這個屬性。
相依財產資訊
| Item | 價值觀 |
|---|---|
| 識別碼欄位 | TextDecorationsProperty |
元資料屬性設為 true |
AffectsRender |