private void DeleteEmail() { var nextEmail = CollectionHelper.GetNextElementOrDefault(EmailListViewModel.Emails, EmailListViewModel.SelectedEmail); EmailFolder.RemoveEmail(EmailListViewModel.SelectedEmail); EmailListViewModel.SelectedEmail = nextEmail ?? EmailListViewModel.Emails.LastOrDefault(); EmailListViewModel.FocusItem(); }
private void DeleteEmail() { // Use the EmailCollectionView, which represents the sorted/filtered state of the emails, to determine the next email to select. var nextEmail = CollectionHelper.GetNextElementOrDefault(EmailListViewModel.EmailCollectionView, EmailListViewModel.SelectedEmail); EmailFolder.RemoveEmail(EmailListViewModel.SelectedEmail); EmailListViewModel.SelectedEmail = nextEmail ?? EmailListViewModel.EmailCollectionView.LastOrDefault(); EmailListViewModel.FocusItem(); }