RichTextBlock.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 = richTextBlock.textDecorations;
richTextBlock.textDecorations = textDecorations;
Public Property TextDecorations As TextDecorations
<RichTextBlock 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 Textdekorationen auf Text in einem RichTextBlock angewendet werden, sowohl auf Steuerelementebene als auch auf TextElement-Ebene .

<RichTextBlock TextDecorations="Underline"
            Loaded="RichTextBlock_Loaded">
    <Paragraph>This text has an underline.</Paragraph>
    <Paragraph TextDecorations="Strikethrough">
        This text has a strikethrough, but no underline.
    </Paragraph>
    <Paragraph TextDecorations="Strikethrough, Underline">This text has it all!</Paragraph>
    <Paragraph x:Name="Paragraph4">This text is decorated in code.</Paragraph>
</RichTextBlock>
private void RichTextBlock_Loaded(object sender, RoutedEventArgs e)
{
    // Apply both strikethough and underline to the last paragraph.
    Paragraph4.TextDecorations =
        TextDecorations.Strikethrough | TextDecorations.Underline;
}

Hinweise

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

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

Gilt für:

Weitere Informationen