public override void ItemHighlighted(UICollectionView collectionView, NSIndexPath indexPath) { // Get cell and change to green background var cell = (UserCell2)collectionView.CellForItem(indexPath); ImageCell2 itemClicked = Cells[indexPath.Row]; if (DeleteEnabled) { if (itemClicked.isSelected) { //cell.ImageView.Alpha = 1.0f; //cell.Layer.BorderColor = UIColor.Red.CGColor; itemClicked.isSelected = false; cell.Layer.BorderColor = AppColors.PEACH.CGColor; cell.Layer.BorderWidth = 10; //remove the object from the list ImagesToDelete.Remove(itemClicked.ImgOBJ); } else { //cell.ImageView.Alpha = 0.5f; itemClicked.isSelected = true; cell.Layer.BorderColor = UIColor.Clear.CGColor; //add the image object to the list ImagesToDelete.Add(itemClicked.ImgOBJ); } } }
public void UpdateRow(ImageCell2 element, SizeF imageViewSize) { var Resultfilename = new DatabaseContext <Image>().GetQuery("SELECT * FROM Image WHERE ID = ?", element.ImgOBJ.ImageID.ToString()); ImageView.Image = Utilities.GetUIImageFromFileNameThumbnail(Resultfilename[0].FileName.ToString()); ImageView.Layer.CornerRadius = 20f; ImageView.Frame = new RectangleF(0, 0, imageViewSize.Width, imageViewSize.Height); }
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath) { var cell = (UserCell2)collectionView.DequeueReusableCell(UserCell2.CellID, indexPath); ImageCell2 row = Cells[indexPath.Row]; cell.UpdateRow(row, ImageViewSize); cell.Layer.BorderColor = UIColor.Red.CGColor; return(cell); }