title: Setting WPF text to TextBlock
body: <p>I know that <code>TextBlock</code> can present a <code>FlowDocument</code>, for example:</p>
  
  <pre><code>&lt;TextBlock Name="txtFont"&gt;
       &lt;Run Foreground="Maroon" FontFamily="Courier New" FontSize="24"&gt;Courier New 24&lt;/Run&gt;
  &lt;/TextBlock&gt;
  </code></pre>
  
  <p>I would like to know how to set a <code>FlowDocument</code> that is stored in a variable to a <code>TextBlock</code>.
  I am looking for something like:</p>
  
  <pre><code>string text = "&lt;Run Foreground="Maroon" FontFamily="Courier New" FontSize="24"&gt;Courier New 24&lt;/Run&gt;"
  txtFont.Text = text;
  </code></pre>
  
  <p>However, The result of the code above is that the XAML text is presented unparsed.</p>
  
  <hr>
  
  <p><strong>EDIT:</strong> I guess my question was not clear enough. What I'm really trying to achive is:</p>
  
  <ol>
  <li>The user input some text into a <em>RichTextBox</em>.</li>
  <li>The application saves the user input as <code>FlowDocument</code> from the <em>RichTextBox</em>, and serializes it to the disk.</li>
  <li>The <code>FlowDocument</code> is deserialized from the disk to the variable <em>text</em>.</li>
  <li>Now, I would like to be able to present the user text in a <code>TextBlock</code>.</li>
  </ol>
  
  <p>Therefore, as far as I understand, creating a new <em>Run</em> object and setting the parameters manually will not solve my problem.</p>
  
  <hr>
  
  <p>The problem is that serializing <em>RichTextBox</em> creates <em>Section</em> object, which I cannot add to <em>TextBlock.Inlines</em>. Therefore, it is not possible to set the deserialized object to <em>TextProperty</em> of <em>TextBlock</em>.</p>