public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row) { int sectionIndex; bool isHeader; int itemIndexInSection; GetComputedIndexes(row, out sectionIndex, out itemIndexInSection, out isHeader); string id; Cell cell; if (isHeader) { id = HeaderIdentifier; cell = _tableView.Model.GetHeaderCell(sectionIndex) ?? new TextCell { Text = _tableView.Model.GetSectionTitle(sectionIndex) }; } else { id = ItemIdentifier; cell = _tableView.Model.GetCell(sectionIndex, itemIndexInSection); } var nativeCell = CellNSView.GetNativeCell(tableView, cell, id, isHeader); return(nativeCell); }
public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row) { var sectionIndex = 0; var itemIndexInSection = (int)row; Cell cell; var isHeader = false; if (IsGroupingEnabled) { GetComputedIndexes(row, out sectionIndex, out itemIndexInSection, out isHeader); } var indexPath = NSIndexPath.FromItemSection(itemIndexInSection, sectionIndex); var templateId = isHeader ? "headerCell" : TemplateIdForPath(indexPath).ToString(); NSView nativeCell; var cachingStrategy = List.CachingStrategy; if (cachingStrategy == ListViewCachingStrategy.RetainElement) { cell = GetCellForPath(indexPath, isHeader); nativeCell = CellNSView.GetNativeCell(tableView, cell, templateId, isHeader); } else if ((cachingStrategy & ListViewCachingStrategy.RecycleElement) != 0) { nativeCell = tableView.MakeView(templateId, tableView); if (nativeCell == null) { cell = GetCellForPath(indexPath, isHeader); nativeCell = CellNSView.GetNativeCell(tableView, cell, templateId, isHeader, true); } else { var templatedList = TemplatedItemsView.TemplatedItems.GetGroup(sectionIndex); cell = (Cell)((INativeElementView)nativeCell).Element; cell.SendDisappearing(); templatedList.UpdateContent(cell, itemIndexInSection); cell.SendAppearing(); } } else { throw new NotSupportedException(); } return(nativeCell); }