I have a ListView. When I select a row I want that only one cell was selected not the whole row. How can I get this? Here is my styles and templates.
<ListView x:Name="List"
ItemsSource="{Binding }"
ItemContainerStyle="{DynamicResource ListItemStyle}">
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn HeaderContainerStyle="{StaticResource myHeaderStyle}"
Header="1"
CellTemplate="{StaticResource myCellTemplate1}">
</GridViewColumn>
<GridViewColumn Header="2"
HeaderContainerStyle="{StaticResource myHeaderStyle}"
HeaderTemplate="{StaticResource myHeaderTemplate}"
CellTemplate="{StaticResource cellTemplate2}">
</GridViewColumn>
<GridViewColumn Header="3"
HeaderContainerStyle="{StaticResource myHeaderStyle}"
HeaderTemplate="{StaticResource myHeaderTemplate}"
CellTemplate="{StaticResource cellTemplate3}" />
<GridViewColumn Header="4"
HeaderContainerStyle="{StaticResource myHeaderStyle}"
HeaderTemplate="{StaticResource myHeaderTemplate}"
CellTemplate="{StaticResource cellTemplate4}"/>
</GridView>
</ListView.View>
</ListView>
<Style x:Key="ListItemStyle" TargetType="{x:Type ListViewItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}" >
<Grid SnapsToDevicePixels="True" Margin="0" Width="410" x:Name="GridSmall">
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="0" />
<GridViewRowPresenter x:Name="Rows" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Yellow"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter Property="Background" Value="Black"/>
<Setter Property="Foreground" Value="Green"/>
</Trigger>
</Style.Triggers>
</Style>
<DataTemplate x:Key="myCellTemplate1">
<DataTemplate.Resources>
<local:NullIdConverter x:Key="NullIdConverterKey"/>
</DataTemplate.Resources>
<DockPanel x:Name="RR">
<TextBlock FontSize="18" x:Name="TxtBl"
HorizontalAlignment="Center"
Text="{Binding Path = Id}"/>
</DockPanel>
</DataTemplate>
Thanks.