title: How to remove gap between ListViewItems in Win7
body: <p>I developed a WPF application under WinXP and my ListView had my expected layout. After starting the same software under Win7, I saw that the ListViewItems have a small gap between each row.
  I played with Margin und Padding for each element, but I can’t find a solution where the layout is the same under WinXP and Win7 without writing individual code.<br>
  I assume that it has something to do with the current Windows theme, but I can’t catch it. Does some have a hint?  </p>
  
  <p>Screenshot WindowsXP<br>
  <img src="https://i.stack.imgur.com/cIOfy.jpg" alt="Layout XP"></p>
  
  <p>Screenshot Windows 7<br>
  <img src="https://i.stack.imgur.com/ZQ5ky.jpg" alt="Layout 7"></p>
  
  <p>Here is some (simplified) XAML that I use  </p>
  
  <pre><code>&lt;ListView x:Name="ListView"&gt;
      &lt;ListView.Resources&gt;
          &lt;Style x:Key="CellBorderStyle" TargetType="{x:Type Border}"&gt;
              &lt;Setter Property="BorderThickness" Value="0,0,1,1"&gt;&lt;/Setter&gt;
              &lt;Setter Property="BorderBrush" Value="LightGray"&gt;&lt;/Setter&gt;
              &lt;Setter Property="Margin" Value="-6,0,-6,0"&gt;&lt;/Setter&gt;
          &lt;/Style&gt;
          &lt;DataTemplate x:Key="NameTemplate"&gt;
              &lt;Border Name="NameBorder" Style="{StaticResource CellBorderStyle}"&gt;
                  &lt;TextBlock&gt;MyName&lt;/TextBlock&gt;
              &lt;/Border&gt;
          &lt;/DataTemplate&gt;
          &lt;DataTemplate x:Key="AddressTemplate"&gt;
              &lt;Border Name="AddressBorder" Style="{StaticResource CellBorderStyle}" Background="LightSteelBlue"&gt;
                  &lt;TextBlock&gt;MyAddress&lt;/TextBlock&gt;
              &lt;/Border&gt;
          &lt;/DataTemplate&gt;
          &lt;DataTemplate x:Key="StreetTemplate"&gt;
              &lt;Border Name="StreetBorder" Style="{StaticResource CellBorderStyle}" Background="LightGreen"&gt;
                  &lt;TextBlock&gt;MyStreet&lt;/TextBlock&gt;
              &lt;/Border&gt;
          &lt;/DataTemplate&gt;
          &lt;DataTemplate x:Key="CityTemplate"&gt;
              &lt;Border Name="CityBorder" Style="{StaticResource CellBorderStyle}"&gt;
                  &lt;TextBlock&gt;MyCity&lt;/TextBlock&gt;
              &lt;/Border&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListView.Resources&gt;
      &lt;ListView.ItemContainerStyle&gt;
          &lt;Style TargetType="ListViewItem"&gt;
              &lt;Setter Property="HorizontalContentAlignment" Value="Stretch"&gt;&lt;/Setter&gt;
              &lt;Setter Property="VerticalContentAlignment" Value="Stretch"&gt;&lt;/Setter&gt;
          &lt;/Style&gt;
      &lt;/ListView.ItemContainerStyle&gt;
      &lt;ListView.View&gt;
          &lt;GridView&gt;
              &lt;GridView.Columns&gt;
                  &lt;GridViewColumn Header="Name" x:Name="colName"
                              CellTemplate="{StaticResource NameTemplate}"&gt;&lt;/GridViewColumn&gt;
                  &lt;GridViewColumn Header="Address" x:Name="colAddress" 
                              CellTemplate="{StaticResource AddressTemplate}"&gt;&lt;/GridViewColumn&gt;
                  &lt;GridViewColumn Header="Street" x:Name="colStreet" 
                              CellTemplate="{StaticResource StreetTemplate}"&gt;&lt;/GridViewColumn&gt;
                  &lt;GridViewColumn Header="City" x:Name="colCity" 
                              CellTemplate="{StaticResource CityTemplate}"&gt;&lt;/GridViewColumn&gt;
              &lt;/GridView.Columns&gt;
          &lt;/GridView&gt;
      &lt;/ListView.View&gt;
  &lt;/ListView&gt;
  </code></pre>