private void DeleteOrdersButton_OnClick(object sender, RoutedEventArgs e) { IList selectedOrders = OrdersDataGrid.SelectedItems; int ordersSize = selectedOrders.Count; for (var i = 0; i < ordersSize; i++) { DataRowView row = (DataRowView)OrdersDataGrid.SelectedItems[i]; string textId = row["Id"].ToString(); int id = Convert.ToInt32(textId); _client.DeleteOrder(id); } OrdersTabItem_OnLoaded(sender, e); }