In this article we are going to learn about the TextBox control and how to add controls to your Windows Store apps built for Windows using C#.
The XAML framework for Windows Store apps is designed for Windows using XAML and includes several controls for entering and editing text, and a set of properties for formatting the text; those properties are:
- TextBox: This type of control is used to enter plain text with limited text.
- PasswordBox: PasswordBox is used for entering a Password from the user in the encypted form.
- RichEditBox: It is used to enter or edit bulk text such as paragraphs.
TextBox
A TextBox control is used to enter and edit unformatted text. You can set the Text either using deisgn or through coding. Here's some important properties of the TextBox control:
- Text: It sets or gets the text of the control.
- IsReadOnly: It accepts a boolean value to make the textbox readonly or not.
- TextWrapping: This property enables to wrap the text in the textbox.
- Selected Text: It is used to get or set the selected text in the textbox.
- Accept Return: This property makes the textbox multiline. It accepts a boolean value.
XAML code:
<TextBox x:Name="textBox1" Height="75" Width="300" Margin="10" Text="Some Text" TextWrapping="Wrap" AcceptsReturn="True"/>
Output
PasswordBox
The PasswordBox control is used to enter a password into the textbox. The user cannot view the entered text. It only displays a dot for each character in the text. Here are some important properties of the PasswordBox:


Comments
Join the conversation! Your thoughts help the community grow.