private void RefreshProcessedFileList(object arg) { MyProcessedFolderFiles.Clear(); MyProcessedFolderListing.RefreshFolderListing(); MyProcessedFolderListing.ReQualifyListedFiles(RSSettingsModel.Instance.ProcessedExtensionSetting); foreach (FileDescriptorModel fd in MyProcessedFolderListing.FileList) { MyProcessedFolderFiles.Add(fd); } MyProcessedGridView.MoveCurrentTo(null); OnPropertyRaised("MyProcessedFolderFilesNo"); OnPropertyRaised("MyProcessedFilesNo"); OnPropertyRaised("MyProcessedFilesShownNo"); }
private void RemoveProcessedItem(object arg) { if (arg != null && (int)arg > -1) { // MyProcessedFolderFiles.RemoveAt((int)arg); Can't do this... // In order for us to properly remove Collection item, we have to precisely know, // what item is at this index of View (View may be filtered, thus index will be different) // FileDescriptorModel fdv = MyProcessedGridView.Cast<FileDescriptorModel>().ToArray()[(int)arg]; Although it works, this seems too complicated FileDescriptorModel fdv = (FileDescriptorModel)MyProcessedGridView.CurrentItem; if (fdv != null) { MyProcessedFolderFiles.Remove(fdv); MyProcessedFolderListing.FileList.Remove(fdv); MyProcessedGridView.MoveCurrentTo(null); OnPropertyRaised("MyProcessedFolderFilesNo"); OnPropertyRaised("MyProcessedFilesNo"); OnPropertyRaised("MyProcessedFilesShownNo"); } } }