この例では、Text プロパティを使用して、TextBox コントロールの初期のテキスト コンテンツを設定する方法を示します。
メモ この例の Extensible Application Markup Language (XAML) バージョンでは、各ボタンの TextBox コンテンツのテキストの前後に <TextBox.Text> タグを使用することもできますが、TextBox は Text プロパティに ContentPropertyAttribute 属性を適用するため、この処理は必要ありません。 詳細については、「XAML の概要 (WPF)」を参照してください。
使用例
<TextBox Name="tbSettingText">
Initial text contents of the TextBox.
</TextBox>
tbSettingText.Text = "Initial text contents of the TextBox."
tbSettingText.Text = "Initial text contents of the TextBox.";