TextBlock.TextDecorations Eigenschaft

Definition

Ruft einen Wert ab, der angibt, welche Dekorationen auf den Text angewendet werden, oder legt diesen fest.

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"/>

Eigenschaftswert

Ein Wert aus der Enumeration. Der Standardwert ist None (Kein).

Windows-Anforderungen

Gerätefamilie
Windows 10 Creators Update (eingeführt in 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (eingeführt in v4.0)

Beispiele

In diesem Beispiel wird gezeigt, wie Dekorationen auf Text angewendet werden.

<!-- 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;
}

Hinweise

Ab dem Windows 10 Creators Update (SDK-Version 15063) ist diese Eigenschaft die bevorzugte Methode zum Durchstreichen oder Unterstreichen von Text.

In früheren Versionen von Windows können Sie Text mit der Underline-Klasse unterstreichen.

Gilt für: