title: WPF:Auto-Expand RichTextBox
body: <p>I have a richtextbox in WPF,</p>
  
  <pre><code>&lt;RichTextBox Name="_RichTextBox" /&gt;
  </code></pre>
  
  <p>And in the code-behind i was able to auto-expand the richtextbox height on the 
  text change</p>
  
  <pre><code>mRichTextBox.SelectionChanged += OnSelectionChanged;
  
  async void OnSelectionChanged(object sender, RoutedEventArgs e)
          {
              mRichTextBox.Height = mRichTextBox.Document.LineHeight;
          }
  </code></pre>
  
  <p>But, the LineHeight is coming NaN for me and so does the Height ,</p>
  
  <p>Is there any other way to achieve this.</p>
  
  <p>Any help is Appreciated!!</p>