private void DeleteSelectedUser_Click(object sender, RoutedEventArgs e) { if (UsersGrid.SelectedIndex != -1) { DataAccessClass.DeleteUser(users[UsersGrid.SelectedIndex].Id); users = DataAccessClass.GetUsers(); UsersGrid.ItemsSource = users; } }