Multiline TextBox control in WPF

Posted by Stian Karlsen on Stack Overflow See other posts from Stack Overflow or by Stian Karlsen
Published on 2010-03-08T14:18:44Z Indexed on 2010/03/08 14:21 UTC
Read the original article Hit count: 389

Filed under:
|
|
|

For some reason I need the content of a TextBox to span multiple lines, and I need this to be defined directly in XAML. I know I can set TextWrapping="Wrap", and I will do that too, but what I need to do is add newlines anywhere I want in the TextBox. Can this be done in XAML?

I know the following example won't work, but what I want is something like this:

<TextBox>Test1 \n Test2 \n Test3</TextBox>

.. and then have these displayed on three lines.

Test1
Test2
Test3

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wpf