private void removeUserClicked(object sender, RoutedEventArgs e) { Button button = e.Source as Button; if (button == null) { return; } GroupMemberModel user = button.DataContext as GroupMemberModel; if (user == null) { return; } ConfirmationDialog errorDialog = new ConfirmationDialog(); errorDialog.Owner = this; errorDialog.Title = "Confirmation Required"; errorDialog.ConfirmationDetails.Message = "Are you sure you want to remove this user?"; if (errorDialog.ShowDialog() == true) { model.RemoveMember(user); } }