private void Remove_Click(object sender, RoutedEventArgs e) { var removeButton = sender as Button; if (removeButton != null) { var parameter = removeButton.CommandParameter; if (parameter != null) { ILR.ApprenticeshipFinancialRecord les2Remove = parameter as ILR.ApprenticeshipFinancialRecord; les2Remove.IsSelected = true; if (les2Remove != null) { ApprenticeshipFinancialItemsCV.MoveCurrentTo(les2Remove); _learningDelivery.Delete(les2Remove); _apprenticeshipFinancialRecordList.Remove(les2Remove); if (!ApprenticeshipFinancialItemsCV.MoveCurrentToPrevious()) { ApprenticeshipFinancialItemsCV.MoveCurrentToFirst(); ApprenticeshipFinancialItemsCV.Refresh(); OnPropertyChanged("ApprenticeshipFinancialItemsCV"); } if (ApprenticeshipFinancialItemsCV.CurrentItem != null && ApprenticeshipFinancialItemsCV.CurrentItem != les2Remove) { ILR.ApprenticeshipFinancialRecord f = ApprenticeshipFinancialItemsCV.CurrentItem as ILR.ApprenticeshipFinancialRecord; f.IsSelected = true; } else { ApprenticeshipFinancialItemsCV.MoveCurrentToNext(); if (ApprenticeshipFinancialItemsCV.CurrentItem != null) { ILR.ApprenticeshipFinancialRecord f = ApprenticeshipFinancialItemsCV.CurrentItem as ILR.ApprenticeshipFinancialRecord; f.IsSelected = true; } } } ApprenticeshipFinancialItemsCV.Refresh(); OnPropertyChanged("ApprenticeshipFinancialItemsCV"); ShouldShowListView(); } } }
private void Remove_Click(object sender, RoutedEventArgs e) { if (ApprenticeshipFinancialItemsCV.CurrentItem != null) { ILR.ApprenticeshipFinancialRecord les2Remove = ApprenticeshipFinancialItemsCV.CurrentItem as ILR.ApprenticeshipFinancialRecord; if (les2Remove != null) { _learningDelivery.Delete(les2Remove); _apprenticeshipFinancialRecordList.Remove(les2Remove); if (!ApprenticeshipFinancialItemsCV.MoveCurrentToPrevious()) { ApprenticeshipFinancialItemsCV.MoveCurrentToFirst(); ApprenticeshipFinancialItemsCV.Refresh(); OnPropertyChanged("ApprenticeshipFinancialItemsCV"); } if ((ApprenticeshipFinancialItemsCV.CurrentItem != null) && (ApprenticeshipFinancialItemsCV.CurrentItem != les2Remove)) { ILR.ApprenticeshipFinancialRecord f = ApprenticeshipFinancialItemsCV.CurrentItem as ILR.ApprenticeshipFinancialRecord; f.IsSelected = true; } else { ApprenticeshipFinancialItemsCV.MoveCurrentToNext(); if (ApprenticeshipFinancialItemsCV.CurrentItem != null) { ILR.ApprenticeshipFinancialRecord f = ApprenticeshipFinancialItemsCV.CurrentItem as ILR.ApprenticeshipFinancialRecord; f.IsSelected = true; } } } ApprenticeshipFinancialItemsCV.Refresh(); } OnPropertyChanged("ApprenticeshipFinancialItemsCV"); ShouldShowListView(); }