title: How to adjust the space between paragraph in a flow document by programming
body: <p>I'm a beginer in C# Wpf and I want to make a flow document with few paragrah by programming.
  The problem is that there is a big space between pagraphs and i want to resize it to its minimum.</p>
  
  <p>I found a solution by using a Xml statement, but i want to make it by programming :</p>
  
  <pre><code>&lt;FlowDocument&gt;
    &lt;FlowDocument.Resources&gt;
      &lt;!-- This style is used to set the margins for all paragraphs in the FlowDocument to 0. --&gt;
      &lt;Style TargetType="{x:Type Paragraph}"&gt;
        &lt;Setter Property="Margin" Value="0"/&gt;
      &lt;/Style&gt;
    &lt;/FlowDocument.Resources&gt;
  
    &lt;Paragraph&gt;
      Spacing between paragraphs is caused by margins set on the paragraphs.  Two adjacent margins
      will "collapse" to the larger of the two margin widths, rather than doubling up.
    &lt;/Paragraph&gt;
  
    &lt;Paragraph&gt;
      To eliminate extra spacing between two paragraphs, just set the paragraph margins to 0.
    &lt;/Paragraph&gt;
  &lt;/FlowDocument&gt;
  </code></pre>
  
  <p>How can i do it ?.</p>
  
  <p>thanx for you're help.</p>