title: wpf datagrid selection changed
body: <p>I used to have the following code using a listview:</p>
  
  <pre><code>private void ListViewSelectionChanged(object sender, SelectionChangedEventArgs e)
          {
              foreach (Exam exam in e.RemovedItems)
              {
                  ViewModel.SelectedExams.Remove(exam);
              }
              foreach (Exam exam in e.AddedItems)
              {
                  ViewModel.SelectedExams.Add(exam);
              }
          }
  </code></pre>
  
  <p>Now I changed to a datagrid but I'm getting an error message that says: Error   1   'System.EventArgs' does not contain a definition for 'RemovedItems' and no extension method 'RemovedItems' accepting a first argument of type 'System.EventArgs' could be found (are you missing a using directive or an assembly reference?)   </p>
  
  <pre><code>private void DataGridSelectionChanged(object sender, EventArgs e)
      {
          foreach (Exam exam in  e.RemovedItems)
          {
              ViewModel.SelectedExams.Remove(exam);
          }
          foreach (Exam exam in e.AddedItems)
          {
              ViewModel.SelectedExams.Add(exam);
          }
      }
  </code></pre>
  
  <p>Can anyone out there help me by telling me how I can capture the selected rows in a datagrid in the same way as I used to capture them in a listview. </p>