I should separate ListViewItem of ListView. I wrote next XAML for it:
<Window.Resources>
<Style x:Key="myTemplate" TargetType="ListViewItem">
<Setter Property="BorderThickness" Value="0,4,0,0"/>
<Setter Property="BorderBrush" Value="Red"/>
</Style>
</Window.Resources>
Now I can use this resources by the next way:
<Grid>
<ListView Name="listview1" HorizontalAlignment="Left" Height="164" Margin="191,83,0,0" VerticalAlignment="Top" Width="307" ItemContainerStyle="{StaticResource myTemplate}" BorderThickness="5">
<ListView.View>
<GridView>
<GridViewColumn>
</GridViewColumn>
</GridView>
</ListView.View>
<!--this data is only for sample. Really it's load by binding-->
<ListViewItem Content="1"/>
<ListViewItem Content="2"/>
<ListViewItem Content="3"/>
</ListView>
Yes, everythink works fine but I don't want to apply this style for first element (I don't want to see border for first element). If I use next way for realize required view, items don't highlighted when it's selected:
<Window.Resources>
<Style x:Key="myTemplate" TargetType="ListViewItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<StackPanel>
<Separator x:Name="Separator"/>
<ContentPresenter/>
</StackPanel>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
<Setter Property="Visibility" TargetName="Separator" Value="Collapsed"/>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
How to realize required view?