title: Append New Paragraph To RichTextBox
body: <p>I need to programmatically add a new paragraph to a RichTextBox control (just like pressing Enter). Using the code below, it does add a new paragraph but:</p>
  
  <ul>
  <li>It deletes all the existing text in the control</li>
  <li>The insertion point remains in the first line and doesn't move to the second newly created line</li>
  <li><p>It only seems to add a new paragraph once, i.e. if I run the code a second time, a third paragraph isn't created</p>
  
  <pre><code>        FlowDocument flowDoc= rtbTextContainer.Document;
          Paragraph pr = new Paragraph();                
          flowDoc.Blocks.Add(pr);
          rtbTextContainer.Document = flowDoc;
  </code></pre></li>
  </ul>
  
  <p>I was testing a few things - I commented out the second and third lines of code, so I was only reading the Document and immediately set it back to the RichTextBox again, but that also deleted all existing text, so the issue might have something to do with that, but I can't figure it out.</p>
  
  <p>How can I overcome these issues and programmatically append a new paragraph, and then set its focus.</p>
  
  <p>Thanks</p>