title: WPF XAML WrapPanel ListBox items in a row
body: <p>I'm forced to ask for help, while I'm not able to figure it out by myself.
  I'm working on WPF-XAML desktop application, in which GUI is mostly generated dynamically.</p>
  
  <p><strong>My query regards styling of WrapPanel with ListBox items.</strong></p>
  
  <p>Please find a piece of code from my usercontrol (.xaml):</p>
  
  <pre><code>&lt;DockPanel x:Name="xResultPanel"&gt;
    &lt;ListView x:Name="bResultPanel" ItemsSource="{Binding ResultList, UpdateSourceTrigger=PropertyChanged}"&gt;
      &lt;ListView.ItemTemplate&gt;
        &lt;DataTemplate&gt;
          &lt;Expander Header="{Binding GroupName}" Style="{DynamicResource FeatureExpander2}"&gt;
            &lt;WrapPanel ItemWidth="140" Orientation="Horizontal"&gt;
              &lt;ListBox x:Name="ListOfTiles" ItemsSource="{Binding VideoSamples}"&gt;
                &lt;ListBox.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                    &lt;StackPanel Width="120" Margin="10" HorizontalAlignment="Left"&gt;
                       &lt;Image /&gt;
                       &lt;TextBlock /&gt;
                    &lt;/StackPanel
                  &lt;/DataTemplate&gt;
                &lt;/ListBox.ItemTemplate&gt;
              &lt;/ListBox&gt;
            &lt;/WrapPanel&gt;
          &lt;/Expander&gt;
        &lt;/DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
    &lt;/ListView&gt;
  &lt;/DockPanel&gt;
  </code></pre>
  
  <p><strong>Above code returns ListBox items presented not in a row, but each item in new line.</strong>
  I tried to set MinWidth, Width etc for WrapPanel and ListBox, but with no result.</p>
  
  <p>Thanks in advance for all related tips how to force WrapPanel to fill it's content horizontally.</p>