title: Listbox Selected Item is always null after an update in the list box in wpf
body: <p>In my WPF application I have a list box which have list of quiz match am playing. Each time a match is created by me / any other opponent am reloading the list. </p>
  
  <p>Current Scenario: Am playing a match, my current match is highlighted based on its ID. While playing itself some other person sends me an invite and it automatically refreshes the list and selected Item turns null. It affects the match which am currently playing.</p>
  
  <p>I need the selectedItem to be same unless the user clicks on other match. So I maintain the ID in the variable and even after reloading the list , with that old ID I want that item to be selected. </p>
  
  <pre><code>List&lt;ChallengePlayerLists&gt; ChallengerLists;
  var filteredlistfortest2 = ChallengerList.Where(x =&gt; x.challengeID == Convert.ToString(challengeID) &amp;&amp; (x.challengeStatus == "Your turn")).ToList().FirstOrDefault();
                  lstChallengeGrid.SelectedItem =  ChallengerList.Where(x =&gt; x.challengeID == Convert.ToString(challengeID) &amp;&amp; (x.challengeStatus == "Your turn")).ToList().FirstOrDefault();
  
  public class ChallengePlayerLists
  { 
      public string challengeID { get; set; }
      public string challengeType { get; set; }
      public string challengerID { get; set; }
      public string opponentID { get; set; }
      public string fullName { get; set; }
      public string userName { get; set; }
      public string challengeStatus { get; set; }
  }
  </code></pre>
  
  <p>First line of code works as expected, I can get the match I want to be selected using the LINQ query. But while assigning it to <code>listbox.SelectedItem</code> it remains as  NULL.</p>
  
  <p>I am not sure why it is null while assigning the same LINQ  to <code>selectedItem</code>.</p>