Where is the Multiline Property in the WPF TextBox?

Maybe you come from the good old WinForms and now you would like to activate the MultiLine Property in the WPF TextBox.
But there is no property with the name MultiLine.

But with the AcceptsReturn and TextWrapping Property you can achieve the same behaviour.
First of all you have to set the AcceptsReturn Property to true. Such that the user can perform a newline with enter.
Finally you have to set the TextWrappingProperty to Wrap or WrapWithOverflow. So it automatically wraps the text if it is to long for the TextBox.


<TextBox AcceptsReturn="True" TextWrapping="Wrap" />

the same in C# Code

TextBox textBox = new TextBox;
textBox.AcceptsReturn = true;
textBox.TextWrapping = TextWrapping.Wrap;
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: