<Style x:Key="lineGridStyle" TargetType="{x:Type ListViewItem}">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Grid Name="background">
<Grid.ColumnDefinitions>
<!-- データを表示するのに必要なだけの列 -->
<ColumnDefinition Width="Auto" />
<!-- 余白部分担当の列 -->
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ContentControl Name="foreground">
<GridViewRowPresenter Name="rowPresenter"/>
</ContentControl>
<ItemsControl ItemsSource="{Binding ElementName=rowPresenter, Path=Columns}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Margin="1,0,0,0"
BorderBrush="Gray"
BorderThickness="0,0,1,1"
Width="{Binding ActualWidth}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- 右の余白に下線を引く -->
<Border Grid.Column="1"
Margin="1,0,0,0"
BorderBrush="Gray"
BorderThickness="0,0,0,1"
Width="{Binding ActualWidth}">
<!-- クリックに反応させるために透明なRectangleを置いておく -->
<Rectangle Fill="Transparent" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="background"
Property="Background"
Value="{x:Static SystemColors.HighlightBrush}" />
<Setter TargetName="foreground"
Property="Foreground"
Value="{x:Static SystemColors.HighlightTextBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>