Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linebreak in TextBox

How can I get a linebreak in TextBox in WP7? I'm developing social-based app(like facebook) and if I set AcceptReturn=true, it gives me a visual(ui) linebreak, but when I send this text to the server I can see that there is no linebreak. Please help me with this problem. I've tried

void whatsend_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) {
      if (e.Key == Key.Enter) {
        whatsend.Text +="\r";//or /n,
      }
    }

but with no success.

like image 397
SevenDays Avatar asked Aug 26 '11 20:08

SevenDays


2 Answers

Windows uses \r\n for line breaks, not \r, but that's irrelevant; use Environment.NewLine instead.

Also, per the docs:

true if the ENTER key creates a new line of text in a multiline version of the control; false if the ENTER key activates the default button for the form. The default is false.

Did you set MultiLine to true?

EDIT: Ahhh, WP7... here is an article I found which attempts to create a multi-line textbox in WP7.

like image 137
Ed S. Avatar answered Nov 13 '22 02:11

Ed S.


Environment.NewLine if its the same as normal development.

like image 2
Gage Avatar answered Nov 13 '22 04:11

Gage