次の方法で共有


TextBlock.TextDecorations プロパティ

定義

TextBlockのテキストに適用する効果を含むTextDecorationCollectionを取得または設定します。

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

プロパティ値

この要素に適用するテキスト装飾を含む TextDecorationCollection コレクション。 既定値は null です (テキスト装飾は適用されません)。

次の例は、 TextDecorations 属性を設定する方法を示しています。

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

次の図は、この例がどのようにレンダリングされるかを示しています。

スクリーンショット: 既定の取り消し線効果を持つ

次の図は、 OverLineBaseline、および Underline 装飾のレンダリング方法を示しています。

スクリーンショット: TextDecorator のオーバーライン

スクリーンショット: テキストに対する既定のベースライン効果スクリーンショット

スクリーンショット: 既定の下線効果を持つテキスト

次の例は、TextDecorations プロパティをプログラムで設定する方法を示しています。

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

注釈

TextDecoration オブジェクトは、テキストに追加できる視覚的な装飾です。 テキスト装飾には、下線、ベースライン、取り消し線、およびオーバーラインの 4 種類があります。 テキスト装飾の詳細については、「 方法: テキスト装飾を作成する」を参照してください。

既定では、このプロパティは null に設定され、関連付けられている TextDecorationCollection はありません。 テキスト効果を追加する前に、新しい TextDecorationCollection を作成し、このプロパティに割り当てます。

依存関係プロパティ情報

品目 価値
識別子フィールド TextDecorationsProperty
に設定されたメタデータ プロパティ true AffectsRender

適用対象