XAML
<TextBox Height="138" Name="textBox_DeliverFrom" Width="257" AcceptsReturn="True" PreviewKeyDown="textBox_DeliverFrom_PreviewKeyDown" />
C#
private void textBox_DeliverFrom_PreviewKeyDown (object sender, KeyEventArgs e)
{
// Do not allow more than 8 Lines
if (e.Key == Key.Enter)
{
if (textBox_DeliverFrom.LineCount > 7)
e.Handled = true;
}
}
One needs to add a PreviewKeyDown handler and ignore then Enter key if the control has reached the required limit.