I have a TextBox that stretches to the width of the window:
<Window ...>
<TextBox VerticalAlignment="Top" />
</Window>
However, the textbox should have a minimum width, and I want scroll bars to be shown, if the textbox cannot be displayed fully. Thus:
<Window ...>
<ScrollViewer HorizontalScrollBarVisibility="Auto">
<TextBox MinWidth="200" VerticalAlignment="Top" />
</ScrollViewer>
</Window>
This, however, has a negative side effect. If the user enters more text than fits into the text box, the text box increases its size:
Is there a way to avoid this effect and still have the scroll bars if the minimum size of the textbox is reached?