TextBlock.Text プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
TextBlockのテキストの内容を取得または設定します。
public:
property System::String ^ Text { System::String ^ get(); void set(System::String ^ value); };
[System.Windows.Localizability(System.Windows.LocalizationCategory.Text)]
public string Text { get; set; }
[<System.Windows.Localizability(System.Windows.LocalizationCategory.Text)>]
member this.Text : string with get, set
Public Property Text As String
プロパティ値
この TextBlockのテキストの内容。 テキスト以外のすべてのコンテンツが削除され、その結果、 TextBlock コンテンツがプレーン テキストで表現されることに注意してください。 既定値は、Empty です。
- 属性
例
次の例は、TextBlock要素のText属性を設定する方法を示しています。
<TextBlock Text="The text contents of this TextBlock element."/>
または、テキスト ランの内容は、単に要素タグ TextBlock 含まれている場合もあります。
次の例は、Text プロパティをプログラムで設定する方法を示しています。
TextBlock textBlock = new TextBlock();
textBlock.Text = "The text contents of this TextBlock.";
Dim textBlock As New TextBlock()
textBlock.Text = "The text contents of this TextBlock."
注釈
TextBlockでプレーン テキストを表示する場合は、このプロパティを使用します。 テキストの書式を設定する必要がある場合は、 Inline オブジェクトを Inlines プロパティに追加します。
依存関係プロパティ情報
| 品目 | 価値 |
|---|---|
| 識別子フィールド | TextProperty |
に設定されたメタデータ プロパティ true |
AffectsMeasure、AffectsRender |