다음을 통해 공유


방법: TextBox 컨트롤의 텍스트 내용 설정

이 예제에서는 Text 속성을 사용하여 TextBox 컨트롤의 처음 텍스트 콘텐츠를 설정하는 방법을 보여줍니다.

참고

이 예제의 XAML(Extensible Application Markup Language) 버전에서는 각 단추의 TextBox 콘텐츠의 텍스트 주위에 <TextBox.Text> 태그를 사용할 수 있지만 TextBoxText 속성에 ContentPropertyAttribute 특성을 적용하기 때문에 이 태그는 필요하지 않습니다. 자세한 내용은 WPF의 XAML을 참조하세요.

Text 속성을 사용하여 텍스트 내용 설정

<TextBox Name="tbSettingText">
  Initial text contents of the TextBox.
</TextBox>

TextBox 컨트롤의 텍스트 내용 설정

tbSettingText.Text = "Initial text contents of the TextBox.";
tbSettingText.Text = "Initial text contents of the TextBox."

참고 항목