Try looking at MaxLines and MinLines Properties.
Top link:
Setting this property changes the size of the text field if the number of visible lines exceeds the limit specified by MaxLines. This property applies only to visible lines and does not limit the number of lines. Depending on its configuration, the text field may contain additional invisible lines available for scrolling. If the Height property is explicitly set in the TextBox, MaxLines and MinLines property values โโare ignored.
Try changing:
<TextBox MinHeight="100" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ...
to
<TextBox MinLines="5" MaxLines="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Edit: Try it. It sets the VerticalContentAlignment for the TabItem . This will save the text box at the top of the Tab , I also set maximum limits on what your available area can hold, if you change the size of your form, you can configure this number to use all available space.
<TabItem Header="Main Tab" VerticalContentAlignment="Top" > <TextBox ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" MinLines="8" MaxLines="8" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" AcceptsReturn="True" /> </TabItem>
Edit:
Further, the reason the scrollbars are not displayed on the TextBox is because TabControl and TabItem resized to TextBox . You need to make the maximum height set either to TabControl , TabItem , or TextBox , which will allow ScrollViewer to work for TextBox .
source share