Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-set-the-text-content-of-a-textbox-control.md
T
Andy De George da363692ff Initial WPF content migrated (#17)
* Reset branch for WPF changes

* Convert BMP to PNG; fix link-out-of-scope err

* Add snippets for WPF... 6794 files!!!!

* Add missing snippets

* update file updated between migration

* Fix paths to include

* update breadcrumb and toc

* fix index links

* fix index links

* fix index links

* fix markdown
2020-09-04 09:46:28 -07:00

1.7 KiB

title, description, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title description ms.date dev_langs helpviewer_keywords ms.assetid
How to: Set the Text Content of a TextBox Control Learn how to use the Text property to set the initial text contents of a Windows Presentation Foundation TextBox control. 03/30/2017
csharp
vb
text content [WPF], setting
TextBox control [WPF], setting text content
bcd25fc7-a52f-4453-b802-2c8d2b335ab8

How to: Set the Text Content of a TextBox Control

This example shows how to use the xref:System.Windows.Controls.TextBox.Text%2A property to set the initial text contents of a xref:System.Windows.Controls.TextBox control.

Note

Although the [!INCLUDETLA#tla_xaml] version of the example could use the <TextBox.Text> tags around the text of each button's xref:System.Windows.Controls.TextBox content, it is not necessary because the xref:System.Windows.Controls.TextBox applies the xref:System.Windows.Markup.ContentPropertyAttribute attribute to the xref:System.Windows.Controls.TextBox.Text%2A property. For more information, see XAML Overview (WPF).

Example

[!code-xamlTextBox_MiscCode#_TextBoxSetTextXAML]

Example

[!code-csharpTextBox_MiscCode#_TextBoxSetText] [!code-vbTextBox_MiscCode#_TextBoxSetText]

See also