#923 – Text Wrapping in a TextBox

By default, the text displayed in a TextBox does not wrap to multiple lines–even if the TextBox is tall enough to accommodate several lines.

<TextBox Text="{Binding NerdQuote}"
                Height="60"/>

923-001
By default, the value of the TextWrapping property of the TextBox is NoWrap. You can set it to Wrap to cause the text to automatically wrap to multiple lines.

<TextBox Text="{Binding NerdQuote}"
                TextWrapping="Wrap"
                Height="60"/>

923-002
When the TextBox wraps text, it tries to wrap at word boundaries, i.e. after seeing a space or hyphen (-).
923-003
If the TextBox is unable to wrap the text, however, it will just wrap at the nearest character.
923-004
Notice also that, if text wrapping is enabled, the wrapping will change dynamically as you resize the TextBox.923-005923-006