TextBlock.TextDecorations Proprietà

Definizione

Ottiene o imposta un TextDecorationCollection che contiene gli effetti da applicare al testo di 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

Valore della proprietà

TextDecorationCollection

Oggetto TextDecorationCollection contenente le decorazioni di testo da applicare a questo elemento. L'impostazione predefinita è null (nessuna decorazione di testo applicata).

Esempio

Nell'esempio seguente viene illustrato come impostare l'attributo TextDecorations .

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

La figura seguente illustra il rendering di questo esempio.

Schermata: testo con effetto Strikethrough predefinito

Le figure seguenti illustrano rispettivamente il rendering delle OverLinedecorazioni , Baselinee Underline .

Schermata: TextDecorator Overline

Schermata: effetto Baseline predefinito sul testo

Schermata: testo con effetto Underline predefinito

Nell'esempio seguente viene illustrato come impostare la TextDecorations proprietà a livello di codice.

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

Commenti

Un TextDecoration oggetto è un ornamento visivo che è possibile aggiungere al testo. Esistono quattro tipi di decorazioni di testo: sottolineatura, baseline, barratura e overline. Per altre informazioni sulle decorazioni di testo, vedere Procedura: Creare una decorazione di testo.

Per impostazione predefinita, questa proprietà è impostata su null e non TextDecorationCollection è associata. Prima di aggiungere eventuali effetti di testo, crearne uno nuovo TextDecorationCollection e assegnarlo a questa proprietà.

Informazioni proprietà di dipendenza

Campo Identificatore TextDecorationsProperty
Proprietà dei metadati impostate su true AffectsRender

Si applica a