private void btnDelete_Click(object sender, RoutedEventArgs e) { RadButton _button = (RadButton)sender; int ID = ((Dealer)_button.DataContext).ID; Dealer _selectedDealer = DealerService.GetByID(ID); if (MessageBox.Show("Delete the dealer: " + _selectedDealer.CompanyName, "Confirm delete dealer", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { DealerService.Delete(_selectedDealer); } LoadDealers(); }