Exentials.MdcBlazor.Tools by Gambarotto Damiano

<PackageReference Include="Exentials.MdcBlazor.Tools" Version="0.7.8-alpha" />

 DataTableColumnContainer

using __Blazor.Exentials.MdcBlazor.DataTableColumnContainer; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.CompilerServices; using Microsoft.AspNetCore.Components.Rendering; using System; using System.Collections; namespace Exentials.MdcBlazor { public class DataTableColumnContainer { private DataColumCollection _column; public DataColumCollection Columns { get { if (_column == null) _column = new DataColumCollection(); return _column; } } [Parameter] public DataTableSource DataSource { get; set; } [Parameter] public bool Selector { get; set; } protected override void BuildRenderTree(RenderTreeBuilder __builder) { TypeInference.CreateCascadingValue_0(__builder, 0, 1, Columns, 2, delegate(RenderTreeBuilder __builder2) { __builder2.AddContent(3, this.get_ChildContent()); }); __builder.AddMarkupContent(4, "\r\n"); __builder.OpenComponent<MdcDataTableHeader>(5); __builder.AddAttribute(6, "ChildContent", (RenderFragment)delegate(RenderTreeBuilder __builder2) { __builder2.OpenComponent<MdcDataTableHeaderRow>(7); __builder2.AddAttribute(8, "ChildContent", (RenderFragment)delegate(RenderTreeBuilder __builder3) { if (Selector) { __builder3.OpenComponent<MdcDataTableHeaderSelector>(9); __builder3.CloseComponent(); } foreach (DataColumn column in Columns) { __builder3.OpenComponent<MdcDataTableHeaderCell>(10); __builder3.AddAttribute(11, "Numeric", RuntimeHelpers.TypeCheck(column.Numeric)); __builder3.AddAttribute(12, "ChildContent", (RenderFragment)delegate(RenderTreeBuilder __builder4) { __builder4.AddContent(13, column.Header); }); __builder3.CloseComponent(); } }); __builder2.CloseComponent(); }); __builder.CloseComponent(); __builder.AddMarkupContent(14, "\r\n"); __builder.OpenComponent<MdcDataTableBody>(15); __builder.AddAttribute(16, "ChildContent", (RenderFragment)delegate(RenderTreeBuilder __builder2) { IEnumerator enumerator = DataSource.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataTableColumnContainer dataTableColumnContainer = this; object i = enumerator.Current; __builder2.OpenComponent<MdcDataTableBodyRow>(17); __builder2.AddAttribute(18, "ChildContent", (RenderFragment)delegate(RenderTreeBuilder __builder3) { if (dataTableColumnContainer.Selector) { __builder3.OpenComponent<MdcDataTableSelector>(19); __builder3.CloseComponent(); } foreach (DataColumn column2 in dataTableColumnContainer.Columns) { __builder3.OpenComponent<MdcDataTableCell>(20); __builder3.AddAttribute(21, "Numeric", RuntimeHelpers.TypeCheck(column2.Numeric)); __builder3.AddAttribute(22, "ChildContent", (RenderFragment)delegate(RenderTreeBuilder __builder4) { __builder4.AddContent(23, column2.GetFormattedValue(i)); }); __builder3.CloseComponent(); } }); __builder2.CloseComponent(); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) disposable.Dispose(); } }); __builder.CloseComponent(); } public DataTableColumnContainer() : this() { } } }