本文整理汇总了C#中UICollectionView.SelectItem方法的典型用法代码示例。如果您正苦于以下问题:C# UICollectionView.SelectItem方法的具体用法?C# UICollectionView.SelectItem怎么用?C# UICollectionView.SelectItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UICollectionView
的用法示例。
在下文中一共展示了UICollectionView.SelectItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCell
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;
}
示例2: SetSelectedCellByItem
protected override void SetSelectedCellByItem(UICollectionView collectionView, object selectedItem)
{
if (selectedItem == null)
ClearSelection(collectionView);
else
{
int i = ItemsSource.IndexOf(selectedItem);
if (i < 0)
ClearSelection(collectionView);
else
collectionView.SelectItem(NSIndexPath.FromRowSection(i, 0), UseAnimations, ScrollPosition);
}
}
示例3: GetCell
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
{
var selector = _itemTemplateMember == null
? null
: _itemTemplateMember.GetValue(collectionView, null) as ICollectionCellTemplateSelector;
if (selector == null)
throw new NotSupportedException("The ItemTemplate is null to create UICollectionViewCell use the ItemTemplate with ICollectionCellTemplateSelector value.");
object item = GetItemAt(indexPath);
NSString identifier = selector.GetIdentifier(item, collectionView);
var cell = (UICollectionViewCell)collectionView.DequeueReusableCell(identifier, indexPath);
_lastCreatedCell = cell;
_lastCreatedCellPath = indexPath;
if (Equals(item, _selectedItem) && !cell.Selected)
collectionView.SelectItem(indexPath, false, UICollectionViewScrollPosition.None);
cell.Tag |= InitializingStateMask;
cell.SetDataContext(item);
if (!HasMask(cell, InitializedStateMask))
{
cell.Tag |= InitializedStateMask;
ParentObserver.GetOrAdd(cell).Parent = collectionView;
selector.InitializeTemplate(collectionView, cell);
}
cell.Tag &= ~InitializingStateMask;
var initializableItem = cell as IHasDisplayCallback;
if (initializableItem != null)
initializableItem.WillDisplay();
return cell;
}