title: System.InvalidCastException: 'Unable to cast object of type 'System.Windows.Documents.FlowDocument' to type 'System.Windows.Media.Visual'.'
body: <pre><code>&lt;ad:DockingManager&gt;
          &lt;ad:LayoutRoot&gt;
              &lt;ad:LayoutPanel Orientation=&quot;Horizontal&quot;&gt;
                  &lt;ad:LayoutPanel&gt;
  
                      &lt;ad:LayoutDocumentPaneGroup&gt;
                          &lt;ad:LayoutDocumentPane &gt;
                              &lt;ad:LayoutDocument&gt;
                                  &lt;RichTextBox&gt;Here is Error!!!&lt;/RichTextBox&gt;
                              &lt;/ad:LayoutDocument&gt;
                          &lt;/ad:LayoutDocumentPane&gt;
                      &lt;/ad:LayoutDocumentPaneGroup&gt;
                  &lt;/ad:LayoutPanel&gt;
                  &lt;ad:LayoutPanel&gt;
                      &lt;ad:LayoutAnchorablePaneGroup&gt;
                          &lt;ad:LayoutAnchorablePane&gt;
                              &lt;ad:LayoutAnchorable&gt;
                                  &lt;RichTextBox x:Name=&quot;achorRichText&quot;&gt;&lt;/RichTextBox&gt;
                                  &lt;/ad:LayoutAnchorable&gt;
                          &lt;/ad:LayoutAnchorablePane&gt;
                      &lt;/ad:LayoutAnchorablePaneGroup&gt;
                  &lt;/ad:LayoutPanel&gt;
                  &lt;/ad:LayoutPanel&gt;         
          &lt;/ad:LayoutRoot&gt;
      &lt;/ad:DockingManager&gt;
  </code></pre>
  <p>I am learning C# using Visual Studio. I am trying to use Xceed Avalondoc. I used a RichTextBox in a LayoutDocument tag. It give this error</p>
  <p><strong>System.InvalidCastException: 'Unable to cast object of type 'System.Windows.Documents.FlowDocument' to type 'System.Windows.Media.Visual'.'</strong></p>
  <p>when I click in the RichTextBox after program runs.</p>
  <p>Can you help me remove this error. Thanks</p>