TextBlock.TextDecorations Propriété

Définition

Obtient ou définit un TextDecorationCollection qui contient les effets à appliquer au texte d'un 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

Valeur de propriété

TextDecorationCollection

Collection TextDecorationCollection qui contient les ornements de texte à appliquer à l'élément. La valeur par défaut est null (aucun ornement de texte n'est appliqué).

Exemples

L’exemple suivant montre comment définir l’attribut TextDecorations .

<TextBlock TextDecorations="Strikethrough">
  This text will render with the strikethrough effect.
</TextBlock>

La figure suivante montre le rendu de cet exemple.

Capture d'écran : texte avec effet barré par défaut

Les illustrations suivantes montrent comment les décorations et Underline les OverLineBaselinerendu des décors, respectivement.

Capture d'écran : Overline TextDecorator

Capture d'écran : effet de la ligne de base par défaut sur le texte

Capture d'écran : texte avec effet souligné par défaut

L’exemple suivant montre comment définir la TextDecorations propriété par programmation.

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

Remarques

Un TextDecoration objet est une ornementation visuelle que vous pouvez ajouter au texte. Il existe quatre types de décorations de texte : soulignement, ligne de base, frappe pas à pas et surligne. Pour plus d’informations sur les décorations de texte, consultez Guide pratique pour créer une décoration de texte.

Par défaut, cette propriété est définie null sur et n’a pas TextDecorationCollection d’associé. Avant d’ajouter des effets de texte, créez-le TextDecorationCollection et affectez-le à cette propriété.

Informations sur les propriétés de dépendance

Champ d’identificateur TextDecorationsProperty
Propriétés de métadonnées définies sur true AffectsRender

S’applique à