This article is a mirror article of machine translation, please click here to jump to the original article.

View: 19429|Reply: 0

[WPF] Set TEXTBOX as a multi-line text input box in WPF

[Copy link]
Posted on 1/12/2016 11:29:49 AM | | | |



Although you can use ricktextbox to achieve multi-line text input, but richtextbox is more complicated, and it is too troublesome to face simple multi-line text input, but WPF's textbox can still achieve multi-line text input like textarea by setting attributes.ASP.NET

The following is the source of a reprint.



This example shows how to use the Extensible Application Markup Language (XAML) to define a TextBox control that will automatically scale to accommodate multiple lines of text.

  Example
Setting the TextWrapping property to Wrap causes the entered text to swap to a new line when it reaches the edge of the TextBox control, automatically expanding the TextBox control to make room for the new line, if necessary.

Setting the AcceptsReturn property to true causes a new line to be inserted when the Return key is pressed, and the TextBox is automatically expanded again to make room for the new row if necessary.

The VerticalScrollBarVisibility property adds a scrollbar to the TextBox so that the contents of the TextBox can be scrolled when the TextBox exceeds the size of the frame or window that contains it.

C #
Copy code

  This TextBox will allow the user to enter multiple lines of text.  When the RETURN key is pressed,
  or when typed text reaches the edge of the text box, a new line is automatically inserted.
</TextBox>





Previous:C# removes the insistence elements in the array
Next:Am I going to decorate my house into a studio to work?
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com