title: Create Horizontal Line in FlowDocument programmatically
body: <p>I am programmatically creating a FlowDocument, then translating it to Rich Text, so a user can edit it in a Rich Text box. I cannot figure out how to insert a horizontal line in the FlowDocument that will display across the whole width of the edit box (and subsequent rendered PDF).</p>
  
  <p>I found this thread which (allegedly) shows how to do exactly what I want, in XAML:</p>
  
  <p><a href="https://stackoverflow.com/questions/2314975/simple-i-think-horizontal-line-in-wpf">Simple (I think) Horizontal Line in WPF?</a></p>
  
  <p>And this one:</p>
  
  <p><a href="http://social.msdn.microsoft.com/forums/en-US/wpf/thread/bcd334c7-8e2b-4e59-a344-4376b30cf847/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/forums/en-US/wpf/thread/bcd334c7-8e2b-4e59-a344-4376b30cf847/</a></p>
  
  <p>I have attempted to replicate this programmatically, like this:</p>
  
  <pre><code>        Line pLine = new Line();
          pLine.Stretch = Stretch.Fill;
          pLine.Stroke = Brushes.Black;
          pLine.X2 = 1;
          para.Inlines.Add( pLine );
  </code></pre>
  
  <p>But, this ends up displaying nothing at all in the resulting RTF edit box. The rest of the Rich Text is there. Just no line at all.</p>
  
  <p>I also tried creating a Table and inserting the text I want to come after the horizontal line into a cell. Then I set a custom border, just for the top of the Table. That gives me a horizontal line, but it doesn't go all the way across the screen (after it's converted to RTF and shown in the RTF edit box), and it doesn't show at all after I render it into a PDF.</p>
  
  <p>I have resorted to the complete hack of just inserting a Run of 60 underscore ('_') characters and a LineBreak. That "works", but it sucks. Can anybody tell me how to do this correctly?</p>