The title pretty much says it all. Paste a string longer than 9600 characters into a TextBox
that has TextWrapping
set to TextWrapping.NoWrap
, and it will split it into 9600-character lines, wrap them, and grow vertically. Is there a good reason for this? Any way to prevent it?
Note that "you shouldn't use TextBox
for a string that long" is a valid opinion, but doesn't answer the question. :)
The XAML to demonstrate this doesn't need to be any more complicated than:
<Window x:Class="TestApp.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="TestWindow" Height="300" Width="300">
<TextBox TextWrapping="NoWrap" HorizontalAlignment="Left" VerticalAlignment="Top" />
</Window>