Search code examples
c#wpftextboxcarriage-return

Start a new line in wpf textbox


I created a small GUI with WPF, containing a Textbox. I want the user to have the ability to start a new line . How do I let the user start a new line in the WPF textbox (with \n or \r)? I want the user to be able to start a new line by pressing "enter".


Solution

  • have you try set on your textbox following property:

    TextWrapping="Wrap"
    VerticalScrollBarVisibility="Visible" (or auto)
    AcceptsReturn="True"