protected override void RenderContent(String innerText, String rawInnerText) { var dataSource = ItemsSource as IEnumerable; var innerTable = new TableControl(); innerTable.DataContext = dataSource; innerTable.Children.Clear(); innerTable.HeaderRows.Clear(); innerTable.FooterRows.Clear(); if (dataSource != null && dataSource.GetEnumerator().MoveNext()) { if (TitleVisibility != Visibility.None && TitleTemplate != null) { innerTable.NewHeaderRow().Add(TitleTemplate .SetColSpan(_columns.Count) .SetProperty(HtmlControl.VisibilityProperty, TitleVisibility)); } if (HeaderVisibility != Visibility.None) { var rows = CreateRowSchema <TableHeaderCell>((col) => col.HeaderTemplate); TableHeaderCell firstCol = null; foreach (var rowSchema in rows) { var tableRow = innerTable.NewHeaderRow(); tableRow.Children.AddRange(rowSchema); if (tableRow.Count > 0) { firstCol = tableRow[0]; } } if (firstCol != null) { firstCol.AddClass("first"); } } //criar o esquema das linhas e colunas da tabela var itemRowSchema = CreateRowSchema((col) => col.ItemTemplate); //por fim fazer um loop no datasource, considerando a paginação e renderizando as linhas var firstRow = true; foreach (var item in dataSource) { foreach (var rowSchema in itemRowSchema) { var tableRow = innerTable.NewRow(); //renderiazar a linha. if (firstRow) { tableRow.AddClass("first"); firstRow = false; } tableRow.DataContext = item; tableRow.Children.AddRange(rowSchema); } } if (FooterVisibility != Visibility.None && _hasFooterCells) { var hrow = new TableHeaderRow(); TableHeaderCell first = null; foreach (var column in _columns) { if (column.ColSpanBehavior == ColSpanBehavior.NoSpan) { hrow.Add(column.FooterTemplate); first = first ?? column.FooterTemplate; } } if (first != null) { first.AddClass("first"); } innerTable.FooterRows.Add(hrow); } } else if (EmptySourceTemplate != null) { innerTable.NewCell() .SetColSpan(Columns.Count) .Add(EmptySourceTemplate); } innerTable.Render(CurrentContext); base.RenderContent("", rawInnerText); }