title: WPF Error: "Items collection must be empty before using ItemsSource."
body: <p>Does anyone know why I keep getting the "Items collection must be empty before using ItemsSource"-Error? </p>
  
  <p>Here is the code:  </p>
  
  <pre><code>        &lt;ScrollViewer Margin="8,8,8,8" Grid.Row="3" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled"&gt;                  
                  &lt;WrapPanel Orientation="Vertical"&gt;
                      &lt;ItemsControl ItemsSource="{Binding}" x:Name="CustomerList" &gt;&gt;
                          &lt;ItemsControl.ItemsPanel&gt;
                              &lt;ItemsPanelTemplate&gt;
                                  &lt;WrapPanel Orientation="Horizontal"&gt;
                                  &lt;/WrapPanel&gt;
                              &lt;/ItemsPanelTemplate&gt;
                          &lt;/ItemsControl.ItemsPanel&gt;
                          &lt;ItemsControl.ItemTemplate&gt;
                              &lt;DataTemplate&gt;
                                  &lt;View:UserControlCustomerDetails&gt;
                                  &lt;/View:UserControlCustomerDetails&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/ItemsControl.ItemTemplate&gt;
                      &lt;/ItemsControl&gt;
                  &lt;/WrapPanel&gt;
              &lt;/ScrollViewer&gt;
  </code></pre>
  
  <p>This is what I do in my Code-Behind:  </p>
  
  <pre><code> CustomerList.ItemsSource = _mainViewModel.CustomerCollection;
  </code></pre>
  
  <p>Note that CustomerCollection is just a simple List<code>&lt;Customers</code>>.</p>
  
  <p>Thanks for your help!</p>
  
  <p>Cheers</p>