title: Get LineCount from a textbox with wrapping
body: <p>I want to get how many lines of the textbox with wrapping. The following code is not working.</p>
  
  <pre><code>void txt_Loaded(object sender, RoutedEventArgs e)
  {
         TextBox t = (TextBox)sender;
         var count = t.LinesCount; // wrong;
         // or
         var lineCount = t.Text.Split(new[] {'\n','r'}).length;
  }
  </code></pre>
  
  <p>I have three lines, but <code>var lineCount = t.Text.Split(new[] {'\n','r'}).length;</code> returns 4.</p>