#924 – TextBox Wrap vs. WrapWithOverflow

When you specify that you want to wrap text within a TextBox, you can set the TextWrapping property to one of:

  • NoWrap
  • Wrap
  • WrapWithOverflow

The WrapWithOverflow indicates that words will be wrapped, wrapping at the nearest space.  But if there is some text that won’t fit into the available space after wrapping at word boundaries, the TextBox will just let the text extend beyond the boundaries of the TextBox.  By contrast, when you specify TextWrapping=Wrap, if the text won’t fit after wrapping at a word boundary, it just wraps in the middle of the word.

Here’s an example of long word wrapping with TextWrapping=Wrap:

924-001

 

Here’s the same text with TextWrapping=WrapWithOverflow.  The long word extends beyond the right side of the TextBox.

924-002