private void Delete(object sender, RoutedEventArgs e) { ObservableCollection <FileEntity> fileList = fileListbox.ItemsSource as ObservableCollection <FileEntity>; if (fileList != null) { foreach (var fileEntity in fileList) { if (fileEntity.IsChecked) { _detailViewModel.Delete(fileEntity.FileId); } } } }