<Window x:Class="DataBinding.WrappedList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:DataBinding"
        Title="WrappedList" Height="308" Width="474"
    >
  <Window.Resources>
    <local:ImagePathConverter x:Key="ImagePathConverter"></local:ImagePathConverter>

    <DataTemplate x:Key="ItemTemplate">      
      <Grid >
        <Grid.ColumnDefinitions>
          <ColumnDefinition SharedSizeGroup="SingleWidthColumn"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.Style>
          <Style>
            <Setter Property="TextBlock.Foreground" Value="Black"></Setter>
          </Style>
        </Grid.Style>
        <Border Margin="5" BorderThickness="1" BorderBrush="SteelBlue"
                     CornerRadius="4">
          <StackPanel Margin="3">
      
           <TextBlock Text="{Binding Path=ModelName}" HorizontalAlignment="Center"></TextBlock>

              <Image Source="{Binding Path=ProductImagePath, Converter={StaticResource ImagePathConverter}}"
                     Width="100"
                     ></Image>
            </StackPanel>
        </Border>
      </Grid>
    </DataTemplate>
    
  </Window.Resources>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"></RowDefinition>
      <RowDefinition></RowDefinition>
    </Grid.RowDefinitions>
    <Button Margin="7,7,7,0" Padding="2" Click="cmdGetProducts_Click">Get Products</Button>
    <ListBox Grid.IsSharedSizeScope="True" Grid.Row="1" Margin="7,3,7,10" Name="lstProducts" ItemTemplate="{StaticResource ItemTemplate}"
             ScrollViewer.HorizontalScrollBarVisibility="Disabled" SnapsToDevicePixels="True">
      <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
          <WrapPanel></WrapPanel>
        </ItemsPanelTemplate>
      </ListBox.ItemsPanel>
    </ListBox>
  </Grid>
</Window>
