title: WPF ListViewItem lost focus event - How to get at the event?
body: <p>I have a listview that you select a row/item on. This is linked to a datatrigger that displays an image on the row. The image should only be displayed when the row is selected.</p>
  
  <p>This part works fine, however when you move the focus to something else, such as a textbox, or a messagebox is displayed, the listviewitem loses focus ie the highlight on the row is no longer displayed. The problem is that my image still remains. It should be hidden/collapsed when the listview loses focus... It works fine if you select a different item/row on the listview.</p>
  
  <p>Can anyone help on this please?</p>
  
  <pre><code>&lt;Style x:Key="deleteImageStyle" TargetType="{x:Type Image}"&gt;
      &lt;Setter Property="Source" Value="Resources/iconDelete.png" /&gt;
      &lt;Setter Property="Margin" Value="0,2,5,0" /&gt;
      &lt;Setter Property="Height" Value="16" /&gt;
      &lt;Setter Property="Width" Value="16" /&gt;
      &lt;Setter Property="HorizontalAlignment" Value="Right" /&gt;
      &lt;Setter Property="VerticalAlignment" Value="Top" /&gt;
      &lt;Setter Property="Cursor" Value="Hand" /&gt;
      &lt;Style.Triggers&gt;
          &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" Value="True"&gt;
              &lt;Setter Property="Visibility" Value="Visible"/&gt;
          &lt;/DataTrigger&gt;
          &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" Value="False"&gt;
              &lt;Setter Property="Visibility" Value="Hidden"/&gt;
          &lt;/DataTrigger&gt;
          &lt;Trigger Property="IsEnabled" Value="False"&gt;
              &lt;Setter Property="Visibility" Value="Hidden" /&gt;
          &lt;/Trigger&gt;
      &lt;/Style.Triggers&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>Regards</p>
  
  <p>TravisPUK</p>