Late answer, but it might help someone:
First create a style for the celltemplate as follows:
<Style x:Key="BorderStyle" TargetType="{x:Type Border}"> <Setter Property="BorderThickness" Value="0,0,1,0"></Setter> <Setter Property="BorderBrush" Value="Black"></Setter> <Setter Property="Margin" Value="0,0,-7,0"></Setter> </Style> <DataTemplate x:Key="_SomeColumnCellTemplate"> <Border Style="{StaticResource BorderStyle}"> <DockPanel Margin="5,0,0,0"> <TextBlock Text="{Binding Name}" Margin="5,0,0,0"/> </DockPanel> </Border> </DataTemplate>
and then set the itemcontainer style as follows:
<Style x:Key="_ItemContainerStyle" TargetType="{x:Type ListViewItem}"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Stretch" /> </Style>
and finally reference your resource like the container of the listview list item as follows (I missed the binding to the source of the list items in this code):
<ListView ItemContainerStyle="{StaticResource _ListViewItemContainerStyle}"> <ListView.View> <GridView> <GridViewColumn Header="SomeName" CellTemplate="{StaticResource _SomeColumnCellTemplate}"/> </GridView> </ListView.View> </ListView>
source share