Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Phone Multi Line Text Box

I want to create a UI element that behaves approximately like the native WP SMS App's input text box.

Basically it should

  • start as a single line text box
  • when my text reaches the end of the first line, it should expand one line to encompass it
  • this needs to go to a Max Height of 5 line (where a line = the text box's Height value)
  • once my text requires more than 5 lines, the text box should stop expanding and a vertical scroll bar should appear

Any suggestions on how I can do this? I'd rather not use events to see how much text I've entered and expand/compress the text box based on that, or create a new UI element from scratch.

If it helps, I've got access to Telerik's RAD Controls for Windows Phone (RadTextBox).

like image 711
drl Avatar asked Oct 03 '13 17:10

drl


People also ask

How do I enable multiline in a text box?

Step 1: Create a windows form. Step 2: Drag the TextBox control from the ToolBox and drop it on the windows form. You can place TextBox anywhere on the windows form according to your need. Step 3: After drag and drop you will go to the properties of the TextBox control to set the Multiline property of the TextBox.

Can a TextBox have multiple lines?

To enable multiple lines of text to be typed in the text box, select the Multi-line check box, and then optionally do one of the following: To prevent users from being able to insert paragraph breaks in the text box by pressing ENTER, clear the Paragraph breaks check box.

How do I start a new line in a text box?

To start a new line of text or add spacing between lines or paragraphs of text in a worksheet cell, press Alt+Enter to insert a line break.

What is multiline text box?

A multiline text box control is a large text box that can display several lines of text or accept this text from user input. Text boxes are often linked to select value lookups and detailed menus. You can place a multiline text box control within a section control.


1 Answers

Have you attempted making use of the FrameworkElement.MaxHeight property? The markup would be similar to:

<TextBox TextWrapping="Wrap" AcceptsReturn="True" MaxHeight="200" />

The given value for max height is simply an example and may not meet your specific needs.

Note: As mentioned in the comments below, be certain to remove any value specified for Height. The declaration will constrain the element to that height at all times.

like image 54
lsuarez Avatar answered Oct 16 '22 18:10

lsuarez