title: WPF: ListView SelectedItem binding works for a split second, then changes back
body: <p>let me start by introducing my current setup:
  I have a ListView that binds its SelectedItem property to the ViewModel, like this:</p>
  
  <pre><code>    &lt;ListView Name="FileListView" ItemsSource="{Binding ImageList}" 
                SelectionChanged="ImageSelectionChanged"
                SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                SelectionMode="Single"&gt;
          &lt;ListView.ItemTemplate&gt;
              &lt;DataTemplate&gt;
                  &lt;view:FileListItem /&gt;
              &lt;/DataTemplate&gt;
          &lt;/ListView.ItemTemplate&gt;
      &lt;/ListView&gt;
  </code></pre>
  
  <p>It's item template (view:FileListItem) is the following:</p>
  
  <pre><code>&lt;Grid MouseDown="FileListItemMouseDown" KeyDown="FileListItemKeyDown"&gt;
      ....
      &lt;TextBlock Name="NewNameTextBlock" 
               Text="{Binding NewName}" 
               Grid.Column="2"
               Visibility="{Binding TextBlockVisibility}" /&gt;
  
      &lt;TextBox Name="NewNameTextBox" 
               Text="{Binding NewName, UpdateSourceTrigger=PropertyChanged}" 
               Grid.Column="2"
               Visibility="{Binding TextBoxVisibility}" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>The idea here is to switch on the TextBox and switch off the TextBlock when the corresponding ListView item is being edited. This works ok, but when I hit a particular key, I want the ListView to select the next item and put that item into editing mode. I catch the KeyDown event as seen above in the ItemTemplate and broadcast a message, which is caught in the DataContext of my ListView like this:</p>
  
  <pre><code>    public ImageFile SelectedItem {
          get { return _selectedItem; }
          set { _selectedItem = value; NotifyPropertyChanged("SelectedItem"); }
      }
  
      public void SelectAndEditThisHandler (object x)
      {
          ImageFile file = x as ImageFile;
          SelectedItem = file;
      }
  </code></pre>
  
  <p>The result is that the selection actually changes for a split second, but then it changes back to the previous selection. I suspect some other UI elements might be handling my key-presses and doing something to change the selection back, but I can't figure out which elements and how to pinpoint them.</p>
  
  <p>Any help would be greatly appreciated! Thanks!</p>
  
  <p>EDIT:
  As requested, the SelectionChanged handler:</p>
  
  <pre><code>    private void ImageSelectionChanged(object sender, SelectionChangedEventArgs e)
      {
          System.Collections.IList filelist = FileListView.SelectedItems;
          if (filelist.Count == 1)
          {
              ImageFile selectedFile = FileListView.SelectedItem as ImageFile;
              Mediator.Instance.NotifyColleagues(Mediator.Operations.ImagePathSelected, selectedFile.OriginalPath);
          }
      }
  </code></pre>
  
  <p>The mediator message broadcast doesn't do anything related to these controls/this problem at all.</p>