#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).

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: