title: Windows phone refresh listbox ItemsSource
body: <p>I have a problem with a RSS feed app. When my app launches, the listbox gets the feeds and show them in my listbox, but when i press my refresh button the listbox never updates, it just show the same items again, but if i close the app, and then relaunch it, it will show the latest feeds. I hope there is someone that can help. Thanks.</p>
  
  <p>MainWindow.xaml:</p>
  
  <pre><code>&lt;ListBox Grid.Row="1" Name="feedListBox" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionChanged="feedListBox_SelectionChanged"&gt;
                      &lt;ListBox.ItemTemplate&gt;
                          &lt;DataTemplate&gt;
                              ...
                              ...
                          &lt;/DataTemplate&gt;
                      &lt;/ListBox.ItemTemplate&gt;
                  &lt;/ListBox&gt;
  </code></pre>
  
  <p>MainWindow.cs:</p>
  
  <pre><code>private void appBarRefresh_Click(object sender, EventArgs e)
      {
          feedListBox.ItemsSource = null;
  
          GetFeed(IsolatedStorageSettings.ApplicationSettings["key"].ToString());
      }
  
  private void GetFeed(string rss)
      {
          WebClient webClient = new WebClient();
  
          webClient.DownloadStringAsync(new System.Uri(rss));
          webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient_DownloadStringCompleted);
      }
  
  private void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
      {
          if (e.Error != null)
          {
              Deployment.Current.Dispatcher.BeginInvoke(() =&gt;
              {
                  MessageBox.Show(e.Error.Message);
              });
          }
          else
          {
              this.State["feed"] = null;
              this.State.Clear();
              this.State["feed"] = e.Result;
  
              UpdateFeedList(e.Result);
          }
      }
  
  private void UpdateFeedList(string feedXML)
      {
          StringReader stringReader = new StringReader(feedXML);
          XmlReader xmlReader = XmlReader.Create(stringReader);
          SyndicationFeed feed = SyndicationFeed.Load(xmlReader);
  
          Deployment.Current.Dispatcher.BeginInvoke(() =&gt;
          {
              feedListBox.ItemsSource = feed.Items;
          });
          ;
      }
  </code></pre>