void FillCache() { ITableModel model = Controller.Model; int sectionCount = model.GetSectionCount(); var newCellCache = new List <Cell>(); var newIsHeaderCache = new List <bool>(); var newNextIsHeaderCache = new List <bool>(); for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) { var sectionTitle = model.GetSectionTitle(sectionIndex); var sectionTextColor = model.GetSectionTextColor(sectionIndex); var sectionRowCount = model.GetRowCount(sectionIndex); if (!string.IsNullOrEmpty(sectionTitle)) { Cell headerCell = model.GetHeaderCell(sectionIndex); if (headerCell == null) { headerCell = new TextCell { Text = sectionTitle, TextColor = sectionTextColor } } ; headerCell.Parent = _view; newIsHeaderCache.Add(true); newNextIsHeaderCache.Add(sectionRowCount == 0 && sectionIndex < sectionCount - 1); newCellCache.Add(headerCell); } for (int i = 0; i < sectionRowCount; i++) { newIsHeaderCache.Add(false); newNextIsHeaderCache.Add(i == sectionRowCount - 1 && sectionIndex < sectionCount - 1); newCellCache.Add((Cell)model.GetItem(sectionIndex, i)); } } _cellCache = newCellCache.ToArray(); _isHeaderCache = newIsHeaderCache.ToArray(); _nextIsHeaderCache = newNextIsHeaderCache.ToArray(); } void InvalidateCellCache() { _cellCache = null; _isHeaderCache = null; _nextIsHeaderCache = null; } void OnModelChanged(object sender, EventArgs e) { InvalidateCellCache(); NotifyDataSetChanged(); }