blazorquickgrid

How to use QuickGrid's upcoming RowClass feature


In .NET 10, QuickGrid will know how to assign a class to rows dynamically. I can't find a sample program nor the SampleQuickGridComponent mentioned in the PR, so I made a demo on github. The gist is:

@page "/"

<div>
    We want something like:
    <table class="quickgrid">
        <thead><tr><th></th></tr></thead>
        <tbody>
            <tr class="make-me-green"><td>green</td></tr>
            <tr><td>plain</td></tr>
        </tbody>
    </table>
</div>

<div>
    and we get:
    <QuickGrid Items=@items.AsQueryable() RowClass=GetRowCssClass>
        <PropertyColumn Property="c => c" />
    </QuickGrid>
</div>

@code {
    static readonly string[] items = { "green", "plain" };
    private string GetRowCssClass(string item) => "make-me-" + item;
}

But, using the fresh .NET 10 release candidate and Visual Studio 2026 Insiders, the RowClass attribute is not interpreted and simply passed on to the generated HTML as <tablerowclass="GetRowCssClass">, as if it the project was targeting .NET 9. So how do we enable the feature? Is there working sample code somewhere?


Solution

  • I can't reproduce <table rowclass="GetRowCssClass">, ,
    so I suspect you have added the 9.x version of the QuickGrid package to your 10.x project.

    The function should return a string? but it seems the transpiler is flexible about that.

    After that you will need ::deep .make-me-green { ... } in your css.