title: Is there an easy/built-in way to get an exact copy (clone) of a XAML element?
body: <p>I need to make areas of XAML <strong>printable</strong> and so have make this button handler:</p>
  
  <pre><code>private void Button_Click_Print(object sender, RoutedEventArgs e)
  {
      Customer.PrintReport(PrintableArea);
  }
  </code></pre>
  
  <p>And in PrintReport I pack the frameworkelement into other elements in order to print it in a slightly <strong>different</strong> way than it is on the screen, like this:</p>
  
  <pre><code>public void PrintReport(FrameworkElement fwe)
  {
      StackPanel sp = new StackPanel();
      sp.Children.Add(fwe);
      TextBlock tb = new TextBlock();
      tb.Text = "hello";
      sp.Children.Add(tb);
  
      PrintDialog dialog = new PrintDialog();
      if (dialog.ShowDialog() == true)
      { 
          dialog.PrintVisual(sp, "Print job"); 
      }
  }
  </code></pre>
  
  <p>But the above gives me the following <strong>error</strong>:</p>
  
  <blockquote>
    <p>Specified element is already the
    logical child of another element.
    Disconnect it first.</p>
  </blockquote>
  
  <p><strong>Is there an easy way to clone the FrameworkElement so that I can manipulate the copy, print it, and then forget about it, leaving the original element in the XAML being displayed on the screen intact?</strong></p>
  
  <p>Something like this I would imagine:</p>
  
  <pre><code>FrameworkElement fwe2 = FrameworkElement.Clone(fwe); //pseudo-code
  </code></pre>