Bagikan melalui


TextBlock.TextDecorations Properti

Definisi

Mendapatkan atau mengatur yang TextDecorationCollection berisi efek untuk diterapkan ke teks 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

Nilai Properti

Koleksi TextDecorationCollection yang berisi dekorasi teks untuk diterapkan ke elemen ini. Defaultnya adalah null (tidak ada dekorasi teks yang diterapkan).

Contoh

Contoh berikut menunjukkan cara mengatur TextDecorations atribut.

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

Gambar berikut menunjukkan bagaimana contoh ini ditampilkan.

Cuplikan layar: Teks dengan efek coretan default

Gambar berikut menunjukkan bagaimana OverLinedekorasi , , Baselinedan Underline dirender, masing-masing.

Cuplikan layar: Cuplikan layar Overline TextDecorator

Cuplikan layar: Efek garis besar default pada teks

Cuplikan layar: Teks dengan efek garis bawah default

Contoh berikut menunjukkan cara mengatur properti TextDecorations secara terprogram.

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

Keterangan

Objek TextDecoration adalah ornamentasi visual yang dapat Anda tambahkan ke teks. Ada empat jenis dekorasi teks: garis bawah, garis besar, coretan, dan garis besar. Untuk informasi selengkapnya tentang dekorasi teks, lihat Cara: Membuat Dekorasi Teks.

Secara default, properti ini diatur ke null dan tidak TextDecorationCollection terkait dengannya. Sebelum menambahkan efek teks apa pun, buat baru TextDecorationCollection dan tetapkan ke properti ini.

Informasi Properti Dependensi

Item Nilai
Bidang pengidentifikasi TextDecorationsProperty
Properti metadata diatur ke true AffectsRender

Berlaku untuk