In WPF textBox, enter does not add a new line

ID : 131392

viewed : 9

Tags : wpftextboxword-wrapwpf

Top 4 Answer for In WPF textBox, enter does not add a new line

vote vote

93

I had similar problem, I solved it with this question using AcceptsReturn="True". So I think, this should work.

vote vote

82

What you have should work fine, assuming

  1. IsReadOnly is false. If you set this to true, then obviously the Enter key won't work.
  2. The control containing the TextBox is not clipping the TextBox, so it appears that the Enter key did not work.

I'd suggest you try this outside of your project to get a better indication of the actual issue.

vote vote

73

Add the following:

TextBox.AcceptsReturn = True; 
vote vote

63

Top 3 video Explaining In WPF textBox, enter does not add a new line

Related QUESTION?