title: WPF copying wrap panel
body: <p>How do I copy WrapPanel?</p>
  
  <p>I have window in which I have WrapPanel with some controls inside. I'd like to copy it inside my code so I would have 2 or more exact looking panels on the same window but with different names for controls. </p>
  
  <p>This is how my XAML looks like:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:WpfApplication1"
      mc:Ignorable="d"
      Title="MainWindow" Height="350" Width="525"&gt;
  &lt;Grid&gt;
      &lt;StackPanel x:Name="stackPanel" HorizontalAlignment="Left" Height="301" Margin="10,10,0,0" VerticalAlignment="Top" Width="498"&gt;
          &lt;WrapPanel x:Name="Wrap1" Height="142" Margin="0,0,345.6,0" VerticalAlignment="Top" Width="152"&gt;
              &lt;Button x:Name="wrap1_button" Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75"/&gt;
              &lt;Button x:Name="wrap1_button1" Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75"/&gt;
              &lt;Label x:Name="wrap1_label" Content="Label" HorizontalAlignment="Left" VerticalAlignment="Top" Width="74"/&gt;
          &lt;/WrapPanel&gt;
      &lt;/StackPanel&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>I would like to get another WrapPanel placed next to first one, named Wrap2 with controls inside wrap2_button, wrap2_button1, wrap2_label. </p>
  
  <p>I tried inserting it in StackPanel and doing something like that:</p>
  
  <pre><code>public partial class MainWindow : Window
  {
      public MainWindow()
      {
          InitializeComponent();
  
          WrapPanel Wrap2 = Wrap1;
          stackPanel.Children.Add(Wrap2);
      }
  }
  </code></pre>
  
  <p>but it doesnt work...</p>