public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var selector = _itemTemplateProvider.TemplateSelector;

            if (selector == null)
            {
                throw new NotSupportedException("The ItemTemplate is null to create UICollectionViewCell use the ItemTemplate with ICollectionCellTemplateSelector value.");
            }
            object item = GetItemAt(indexPath);
            UICollectionViewCell cell;
            var cellTemplateSelectorSupportDequeueReusableCell = selector as ICollectionCellTemplateSelectorSupportDequeueReusableCell;

            if (cellTemplateSelectorSupportDequeueReusableCell == null)
            {
                cell = (UICollectionViewCell)collectionView.DequeueReusableCell(selector.GetIdentifier(item, collectionView), indexPath);
            }
            else
            {
                cell = cellTemplateSelectorSupportDequeueReusableCell.DequeueReusableCell(collectionView, item, indexPath);
            }

            cell.SetDataContext(item);
            if (!HasMask(cell, InitializedStateMask))
            {
                cell.Tag |= InitializedStateMask;
                ParentObserver.GetOrAdd(cell).Parent = collectionView;
                selector.InitializeTemplate(collectionView, cell);
                InitializeCell(cell);
            }
            CellMediator.Attach(collectionView, cell, indexPath);
            return(cell);
        }
 public override void RowDeselected(UITableView tableView, NSIndexPath indexPath)
 {
     UpdateSelectedItemInternal(tableView, indexPath, false);
     CellMediator.SetFromCell(tableView, indexPath, false);
 }
 public override void CellDisplayingEnded(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
 {
     CellMediator.Deattach(cell);
 }
 public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
 {
     CellMediator.Attach(tableView, cell, indexPath);
 }
 public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath)
 {
     UpdateSelectedItemInternal(collectionView, GetItemAt(indexPath), true);
     CellMediator.SetFromCell(collectionView, indexPath, true);
 }
 public override void CellDisplayingEnded(UICollectionView collectionView, UICollectionViewCell cell, NSIndexPath indexPath)
 {
     CellMediator.Deattach(cell);
 }
 public override void ItemDeselected(UICollectionView collectionView, NSIndexPath indexPath)
 {
     UpdateSelectedItemInternal(collectionView, indexPath, false);
     CellMediator.SetFromCell(collectionView, indexPath, false);
 }
 public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
 {
     UpdateSelectedItemInternal(tableView, GetItemAt(indexPath), true);
     CellMediator.SetFromCell(tableView, indexPath, true);
 }