In WPF textBox, enter does not add a new line

后端 未结 3 1745
北荒
北荒 2021-02-06 21:43

Text box is defined in following code:



        
相关标签:
3条回答
  • 2021-02-06 22:18

    Add the following:

    TextBox.AcceptsReturn = True;
    
    0 讨论(0)
  • 2021-02-06 22:35

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

    0 讨论(0)
  • 2021-02-06 22:40

    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.

    0 讨论(0)
提交回复
热议问题