public override UICollectionViewCell GetCell(UICollectionView collectionView, Foundation.NSIndexPath indexPath) { TaskCell cell = (TaskCell)collectionView.DequeueReusableCell(TaskCell.CellId, indexPath); cell.ApplyCurrentTheme(); KinderTask task = tasks [indexPath.Row]; cell.TaskName = task.Name; cell.TaskIcon = UIImage.FromBundle(task.IconName); cell.SetCellSize(GetCellSize(collectionView)); cell.Selected = task.IsPending; if (task.IsPending) { collectionView.SelectItem(indexPath, false, UICollectionViewScrollPosition.None); } else { collectionView.DeselectItem(indexPath, false); } if (ShouldAnimateAppearance) { cell.AnimateIconAppearance(); } return(cell); }
void HandleSelectionDeselection(NSIndexPath path) { int index = (int)path.Row; KinderTask task = tasks [index]; viewModel.Apply(task); }