TextBox
The TextBox
presents an area for typed (keyboard) input. It can be for a single or multiple lines of input.
Useful Properties
You will probably use these properties most often:
Property | Description |
---|---|
Text | The current text in the input. |
PasswordChar | Hides any characters typed, and replacing them with the given character instead. |
Watermark | Appears as a faded hint whenever the input is empty. |
AcceptsReturn | Makes the input multi-line by allowing the user to enter line returns. A vertical scrollbar will appear if the content exceeds the height available. |
TextWrapping | Defines how horizontal line overflow will be handled. Options are: 'NoWrap', 'Wrap' and 'WrapWithOverflow'. |
Example
This example has a basic one line text box, a password box, and a text-wrapping multiline text box:
<StackPanel Margin="20">
<TextBlock Margin="0 5" >Name:</TextBlock>
<TextBox Watermark="Enter your name"/>
<TextBlock Margin="0 5" >Password:</TextBlock>
<TextBox PasswordChar="*" Watermark="Enter your password"/>
<TextBlock Margin="0 15 0 5">Notes:</TextBlock>
<TextBox Height="100" AcceptsReturn="True" TextWrapping="Wrap"/>
</StackPanel>
![](/ru/assets/images/textbox-entry-70ec288c387ffb63f964eef2fe266eab.gif)
More Information
к сведению
For the complete API documentation about this control, see here.
к сведению
View the source code on GitHub TextBox.cs