title: WPF , ObservableCollections, bindings and stuff . When i iterably try to remove the whole collection I'm only capable of removing only it's half
body: <p>I've came to WPF from winforms , and I'm prety new to it . So here is my question . When i iterably try to remove items from ObservableCollection binded to ListBox via lambda expression it works just fine :</p>
  
  <pre><code>ObservableCollectionGoodsListBoxTemp.ToList().All(i =&gt; ObservableCollectionGoodsListBoxTemp.Remove(i));
  </code></pre>
  
  <p>But when i try using this method , i'am only capable of removing only half of items for each time this code runs :</p>
  
  <pre><code>for (int i = 0; i &lt; ObservableCollectionGoodsListBoxTemp.Count; i++)
  {
      MessageBox.Show(ObservableCollectionGoodsListBoxTemp.Count.ToString() + " " + i.ToString());
          ObservableCollectionGoodsListBoxTemp.RemoveAt(i);
          PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(ObservableCollectionGoodsListBoxTemp)));
  
  }
  </code></pre>
  
  <p>1 The first question is why .<br>
  2 The second question is if this question is stupid ?
  3 The third question is , how to get a grip on WPF and understand how to work with it if the question is stupid</p>