diff --git a/Radzen.Blazor/RadzenTable.razor.cs b/Radzen.Blazor/RadzenTable.razor.cs index 2249c06f4ad..666c604791e 100644 --- a/Radzen.Blazor/RadzenTable.razor.cs +++ b/Radzen.Blazor/RadzenTable.razor.cs @@ -24,6 +24,20 @@ namespace Radzen.Blazor /// public partial class RadzenTable : RadzenComponentWithChildren { + /// + /// Gets or sets the grid lines. + /// + /// The grid lines. + [Parameter] + public DataGridGridLines GridLines { get; set; } = DataGridGridLines.Default; + + /// + /// Gets or sets a value indicating whether RadzenTable should use alternating row styles. + /// + /// true if RadzenTable is using alternating row styles; otherwise, false. + [Parameter] + public bool AllowAlternatingRows { get; set; } = true; + List rows = new List(); /// @@ -55,7 +69,19 @@ public void RemoveRow(RadzenTableRow row) /// protected override string GetComponentCssClass() { - return "rz-grid-table"; + var styles = new List(new string[] { "rz-grid-table" }); + + if (AllowAlternatingRows) + { + styles.Add("rz-grid-table-striped"); + } + + if (GridLines != DataGridGridLines.Default) + { + styles.Add($"rz-grid-gridlines-{Enum.GetName(typeof(DataGridGridLines), GridLines).ToLower()}"); + } + + return string.Join(" ", styles); } } } diff --git a/RadzenBlazorDemos/Pages/TableConfig.razor b/RadzenBlazorDemos/Pages/TableConfig.razor index 0aae7b1e3fc..c7b509e3780 100644 --- a/RadzenBlazorDemos/Pages/TableConfig.razor +++ b/RadzenBlazorDemos/Pages/TableConfig.razor @@ -1,14 +1,28 @@ - - - - @for (var i = 0; i < cols; i++) - { - var col = i; - - @($"Column {col}") - - } - + + + + + + +
GridLines:
+ +
+
+ + + + + @for (var i = 0; i < cols; i++) + { + var col = i; + + @($"Column {col}") + + } + + + @for (var i = 0; i < rows; i++) { var row = i; @@ -22,8 +36,12 @@ } } + @code{ + Radzen.DataGridGridLines gridLines = Radzen.DataGridGridLines.Default; + bool allowAlternatingRows = true; + int rows = 10; int cols = 10; } \ No newline at end of file