Skip to content

Commit 886d073

Browse files
authored
QuickGrid RowClass parameter (#34664)
1 parent 7f591ac commit 886d073

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

aspnetcore/blazor/components/quickgrid.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,34 @@ QuickGrid also supports passing custom attributes and style classes (<xref:Micro
191191
<QuickGrid Items="..." custom-attribute="value" Class="custom-class">
192192
```
193193

194+
:::moniker range=">= aspnetcore-10.0"
195+
196+
## Style a table row based on the row item
197+
198+
<!-- UPDATE 10.0 API cross-link -->
199+
200+
Apply a stylesheet class to a row of the grid based on the row item using the `RowClass` parameter.
201+
202+
In the following example:
203+
204+
* A row item is represented by the `Person` [record](/dotnet/csharp/language-reference/builtin-types/record). The `Person` record includes a `FirstName` property.
205+
* The `HighlightJulie` method applies the `highlight` class styles to any row where the person's first name is "`Julie`."
206+
207+
```razor
208+
<QuickGrid ... RowClass="HighlightJulie">
209+
...
210+
</QuickGrid>
211+
212+
@code {
213+
private record Person(int PersonId, string FirstName, string LastName);
214+
215+
private string HighlightJulie(Person person) =>
216+
person.FirstName == "Julie" ? "highlight" : null;
217+
}
218+
```
219+
220+
:::moniker-end
221+
194222
## Entity Framework Core (EF Core) data source
195223

196224
Use the factory pattern to resolve an EF Core database context that provides data to a `QuickGrid` component. For more information on why the factory pattern is recommended, see <xref:blazor/blazor-ef-core>.

0 commit comments

Comments
 (0)