Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't eliminate padding/margin between Tiles in Windows 8 Metro 'ListView'
    text
    copied!<p>I'm trying to build two <code>ListView</code> objects within a <code>StackPanel</code> and have all of the <code>ItemTemplate</code> Tiles "touch" each other (meaning no margin or padding within the <code>ListView</code>s). It seems that Windows 8 Metro has some sort of built-in padding/margin. <strong>My question:</strong> How do I remove these or set them to <code>0</code>?</p> <p>Here is my code:</p> <pre><code>&lt;StackPanel x:Name="teesSP" HorizontalAlignment="Left" Orientation="Horizontal" VerticalAlignment="Top" &gt; &lt;ListView x:Name="timesLV1" SelectionMode="Multiple" SelectionChanged="timesLV_Click" ItemTemplate="{StaticResource TimeTileTemplate}"&gt; &lt;ListView.ItemContainerStyle&gt; &lt;Style TargetType="ListViewItem"&gt; &lt;Setter Property="Padding" Value="0"/&gt; &lt;Setter Property="Margin" Value="0"/&gt; &lt;/Style&gt; &lt;/ListView.ItemContainerStyle&gt; &lt;/ListView&gt; &lt;ListView x:Name="timesLV2" SelectionMode="Multiple" SelectionChanged="timesLV_Click" ItemTemplate="{StaticResource TimeTileTemplate}"&gt; &lt;ListView.ItemContainerStyle&gt; &lt;Style TargetType="ListViewItem"&gt; &lt;Setter Property="Padding" Value="0"/&gt; &lt;Setter Property="Margin" Value="0"/&gt; &lt;/Style&gt; &lt;/ListView.ItemContainerStyle&gt; &lt;/ListView&gt; &lt;/StackPanel&gt; </code></pre> <p>My <code>ItemTemplate</code> is:</p> <pre><code>&lt;DataTemplate x:Key="TimeTileTemplate"&gt; &lt;Grid HorizontalAlignment="Center" Background="White" &gt; &lt;Border BorderBrush="Black" BorderThickness="2" &gt; &lt;StackPanel Margin="0,0,0,0" Orientation="Horizontal" Width="130" Height="60" VerticalAlignment="Center" &gt; &lt;TextBlock Margin="2,0,0,0" TextWrapping="Wrap" Style="{StaticResource ItemSubtitleStyle}" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding startTime}" Width="70" /&gt; &lt;TextBlock TextWrapping="Wrap" Style="{StaticResource ItemTitleStyle}" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{Binding startHole}" Width="40" /&gt; &lt;/StackPanel&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; </code></pre> <p>...and it renders the following:</p> <p><img src="https://i.stack.imgur.com/eyztF.jpg" alt="ListView with margins/padding"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload