#257 – TextBox Control Allows Basic Text Entry and Editing

You can use the Label and TextBlock controls for displaying text.  If you want to go beyond just displaying text, and want a user to be able to enter or edit text, you can use the TextBox control.

Here’s an example of a simple single-line TextBox.  The Text property represent the current content of the TextBox.

		<TextBox Width="180" Margin="20" Text="Pete Zaria"/>


Note that the user can highlight and edit the text in the control.

We can also make the TextBox larger and set its TextWrapping property, so that it displays multiple lines.  In the example below, we also turn on a vertical scrollbar.  Also note that we set the text as the content of the control.

		<TextBox Width="160" Height="120" Margin="20" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto">
			By three methods etc.
		</TextBox>


We can also change the font, using one or more font-related properties (e.g. FontFamily, FontSize, FontStyle, FontWeight).