TextBlock.TextDecorations プロパティ

定義

テキストに適用される装飾を示す値を取得または設定します。

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

void TextDecorations(TextDecorations value);
public TextDecorations TextDecorations { get; set; }
var textDecorations = textBlock.textDecorations;
textBlock.textDecorations = textDecorations;
Public Property TextDecorations As TextDecorations
<TextBlock TextDecorations="textDecorationsMemberName"/>

プロパティ値

列挙体の値。 既定値は [None](なし) です。

この例では、テキストに装飾を適用する方法を示します。

<!-- Apply underline. -->
<TextBlock Text="Sample text" TextDecorations="Underline"/>

<!-- Apply underline and strikethrough. -->
<TextBlock Text="Sample text" TextDecorations="Underline, Strikethrough"/>

<!-- Apply decorations in code. -->
<TextBlock x:Name="TextBlock3" Text="Sample Text"
           Loaded="TextBlock_Loaded" />
private void TextBlock_Loaded(object sender, RoutedEventArgs e)
{
    // Apply both strikethough and underline to TextBlock3.
    TextBlock3.TextDecorations =
        TextDecorations.Strikethrough | TextDecorations.Underline;
}

注釈

Windows 10 Creators Update (SDK バージョン 15063) 以降では、このプロパティがテキストの取り消し線または下線を引くための推奨される方法です。

以前のバージョンの Windows では、Underline クラスでテキストに 下線 を付けることができます。

適用対象