title: Horizontal stackpanel to wrap DataBinded ItemsControl
body: <p>I have an ItemsControl for which the ItemsSource is Binded. i coded it as per the below so that it would add the UserControl (showing the different items) to a StackPanel with a horizontal orientation that then contains a wrappanel to wrap the items inside but it is not working. All of the items are showing but they are all on one line and do not wrap to a new line when needed.</p>
  
  <p>How can this code be fixed to include wrapping?</p>
  
  <pre><code>    &lt;ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto"
                     Grid.Column="0" Grid.Row="1"&gt;
          &lt;ItemsControl x:Name="tStack"
                        ScrollViewer.HorizontalScrollBarVisibility="Auto"
                        ScrollViewer.VerticalScrollBarVisibility="Auto" Grid.Row="1"
                    ItemsSource="{Binding Items.View}"&gt;
          &lt;ItemsControl.ItemsPanel&gt;
              &lt;ItemsPanelTemplate&gt;
                  &lt;WrapPanel x:Name="stckPnl" Orientation="Horizontal"/&gt;
                  &lt;/ItemsPanelTemplate&gt;
          &lt;/ItemsControl.ItemsPanel&gt;
          &lt;ItemsControl.ItemTemplate&gt;
              &lt;DataTemplate&gt;
                      &lt;StackPanel&gt;
                          &lt;WrapPanel&gt;
                          &lt;Viewbox HorizontalAlignment="Left" Height="400"&gt;
                              &lt;Controls1:MyItemsUserControl Padding="5"/&gt;
                          &lt;/Viewbox&gt;
                          &lt;/WrapPanel&gt;
                      &lt;/StackPanel&gt;
                  &lt;/DataTemplate&gt;
          &lt;/ItemsControl.ItemTemplate&gt;
          &lt;/ItemsControl&gt;
      &lt;/ScrollViewer&gt;
  </code></pre>