title: WPF DataGrid Remove SelectedItems
body: <p>Recently I've been working on a project which imports data programmicaly into a WPF DataGrid.</p>
  
  <p>I'm almost done with the project but the thing that I left out was a button to remove selected cells and this is where I'm stuck!</p>
  
  <p>I wrote this code using my basic knowledge of DataGrids:</p>
  
  <pre><code>var grid = dataGrid1;
  if (grid.SelectedIndex &gt;= 0)
   {
     for (int i = 0; i &lt;= grid.SelectedItems.Count; i++)
     {
        grid.Items.Remove(grid.SelectedItems[i]);
     };
   }
  </code></pre>
  
  <p>Works fine on removing only the item selected just like CurrentItem but it doesn't remove anymore than 2 selected items!</p>
  
  <p>The DataGrid I have should at least contain a minimum of 100 items. I've added a remove all option but this is also necessary.</p>
  
  <p>I'll be thankful if anyone gives me the solution.</p>