static List <ElementInfo> Find(CellGroup cellGroup, ListView listView, Predicate <Element> predicate, Predicate <Element> containerPredicate) { var result = new List <ElementInfo>(); if (cellGroup.Header != null) { result.AddRange(cellGroup.Header.Find(predicate, containerPredicate)); } foreach (var cell in cellGroup.Content) { var info = GetElementInfo(predicate, containerPredicate, cell); if (info != null) { if (info.InvokeTap == null) { info.InvokeTap = () => listView.Invoke("NotifyRowTapped", cell.GetIndex <ItemsView <Cell>, Cell>(), cell); } result.Add(info); } } return(result); }
static CellGroup GetCellGroup(ITemplatedItemsList <Cell> templatedItems, CellCacheProvider cacheProvider) { var result = new CellGroup(); result.Header = templatedItems.HeaderContent; result.Content = new List <Cell>(); for (int i = 0; i < templatedItems.Count; i++) { var item = templatedItems.ListProxy[i]; var cellCache = cacheProvider.GetCellCache(item); Cell cell = cellCache.GetNextUnusedCell(); if (cell != null) { cell.SendDisappearing(); templatedItems.UpdateContent(cell, i); cell.SendAppearing(); } else { cell = templatedItems[i]; cellCache.AddUsedCell(cell); cell.SendAppearing(); } result.Content.Add(cell); } return(result); }
static string Render(CellGroup cellGroup) { string result = ""; if (cellGroup.Header != null) { result += Render(cellGroup.Header).TrimStart('\n') + "\n"; } foreach (var cell in cellGroup.Content) { result += $"- {(cell as TextCell)?.Text + (cell as ViewCell)?.View.Render().Trim()}\n"; } return(result); }