title: WPF ListView column selection
body: <p>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.</p>
  
  <pre><code> &lt;ListView x:Name="List"                   
                ItemsSource="{Binding }"  
                ItemContainerStyle="{DynamicResource ListItemStyle}"&gt;          
          &lt;ListView.View&gt;
              &lt;GridView AllowsColumnReorder="False"&gt;
                  &lt;GridViewColumn HeaderContainerStyle="{StaticResource myHeaderStyle}"                                  
                                  Header="1"
                                  CellTemplate="{StaticResource myCellTemplate1}"&gt;                        
                  &lt;/GridViewColumn&gt;
  
                  &lt;GridViewColumn Header="2"                               
                                  HeaderContainerStyle="{StaticResource myHeaderStyle}"
                                  HeaderTemplate="{StaticResource myHeaderTemplate}"
                                  CellTemplate="{StaticResource cellTemplate2}"&gt;                       
                  &lt;/GridViewColumn&gt;
  
                  &lt;GridViewColumn Header="3" 
                                  HeaderContainerStyle="{StaticResource myHeaderStyle}"
                                  HeaderTemplate="{StaticResource myHeaderTemplate}"
                                  CellTemplate="{StaticResource cellTemplate3}" /&gt;
  
                  &lt;GridViewColumn Header="4" 
                                  HeaderContainerStyle="{StaticResource myHeaderStyle}"
                                  HeaderTemplate="{StaticResource myHeaderTemplate}"
                                  CellTemplate="{StaticResource cellTemplate4}"/&gt;
  
              &lt;/GridView&gt;
          &lt;/ListView.View&gt;
      &lt;/ListView&gt;
  
       &lt;Style x:Key="ListItemStyle"   TargetType="{x:Type ListViewItem}"&gt;             
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate  TargetType="{x:Type ListViewItem}" &gt;
                  &lt;Grid SnapsToDevicePixels="True"   Margin="0"  Width="410" x:Name="GridSmall"&gt;
                      &lt;Border x:Name="Border"                                                      
                              Background="{TemplateBinding Background}"
                              BorderBrush="{TemplateBinding BorderBrush}"
                              BorderThickness="{TemplateBinding BorderThickness}"
                              CornerRadius="0"    /&gt;
                      &lt;GridViewRowPresenter x:Name="Rows" /&gt;
                  &lt;/Grid&gt;                    
              &lt;/ControlTemplate&gt;                
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
      &lt;Style.Triggers&gt;              
          &lt;Trigger Property="IsSelected" Value="True"&gt;
              &lt;Setter Property="Background" Value="Yellow"/&gt;
              &lt;Setter Property="Foreground" Value="Black"/&gt;
          &lt;/Trigger&gt;
          &lt;Trigger Property="IsSelected" Value="False"&gt;
              &lt;Setter Property="Background" Value="Black"/&gt;
              &lt;Setter Property="Foreground" Value="Green"/&gt;
          &lt;/Trigger&gt;
      &lt;/Style.Triggers&gt;
  &lt;/Style&gt;
  
    &lt;DataTemplate x:Key="myCellTemplate1"&gt;
      &lt;DataTemplate.Resources&gt;
          &lt;local:NullIdConverter x:Key="NullIdConverterKey"/&gt;            
      &lt;/DataTemplate.Resources&gt;        
      &lt;DockPanel x:Name="RR"&gt;
          &lt;TextBlock FontSize="18" x:Name="TxtBl"                        
                     HorizontalAlignment="Center"                       
                     Text="{Binding Path = Id}"/&gt;   
      &lt;/DockPanel&gt;      
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>Thanks.</p>