Hello,
I used to have the following code using a listview:
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);
}
}
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?)
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);
}
}
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.