public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { string cellId = GetCellId(indexPath.Row); BareUITableViewCell cell = tableView.DequeueReusableCell(cellId) as BareUITableViewCell; // If no cells to reuse, create a new one if (cell == null) { switch (cellId) { case CELL_ID_ITEM: cell = new UITaskCell(CELL_ID_ITEM); break; case CELL_ID_HEADER: cell = new UIFriendlyDateHeaderCell(CELL_ID_HEADER); break; case CELL_ID_SHOW_HIDE_OLD_ITEMS_BUTTON: cell = new UIShowHideOldItemsCell(CELL_ID_SHOW_HIDE_OLD_ITEMS_BUTTON, _viewModel.ClassViewModel.ViewItemsGroupClass, _viewModel.Type); break; } } // We don't set data context on the Show Hide old items button, since it already set the data context in its construtor if (cellId != CELL_ID_SHOW_HIDE_OLD_ITEMS_BUTTON) { cell.DataContext = GetItem(indexPath.Row); } return(cell); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { string cellId = GetCellId(indexPath.Row); BareUITableViewCell cell = tableView.DequeueReusableCell(cellId) as BareUITableViewCell; // If no cells to reuse, create a new one if (cell == null) { switch (cellId) { case CELL_ID_ITEM: cell = new UITaskCell(CELL_ID_ITEM); break; case CELL_ID_HEADER: cell = new UIFriendlyDateHeaderCell(CELL_ID_HEADER); break; case CELL_ID_BUTTON: cell = new BareUITableViewCell(CELL_ID_BUTTON); break; } } cell.DataContext = GetItem(indexPath.Row); return(cell); }