private void ChangeAccountStatus_Click(object sender, RoutedEventArgs e) { var acd = accountList.SelectedItem as Account; if (acd != null) { acc.ChangeAccountStatus(acd); UpdateAccount(); MessageBox.Show("Status has been changed successfully"); } else { MessageBox.Show("Please select an account"); } }