Filter Blazor DataGrid columns by enum values - the grid lists the enum members as filter options so users pick from a friendly list.
The text of an enum value comes from its Display or Description attribute, or from the member name. Set EnumTranslationFunc to translate
the enum value itself in the cells, the filter options and the exported data - it can tell apart members of different enums that share a name and return null to keep the default text.
EnumFilterTranslationFunc translates the resolved text instead.
ID | Gender (EnumTranslationFunc) | Nullable Status | Favorite Color (Display Attribute in Filter) |
|---|---|---|---|
| 0 | Mr. | Active | Red |
| 1 | Mr. | Active | Red |
| 2 | Mr. | Active | Almond Green |
| 3 | Ms. | Inactive | Almond Green |
| 4 | Ms. | Inactive | Apple Blue... |
| 5 | Ms. | Inactive | Apple Blue... |
| 6 | Not specified | Azure | |
| 7 | Not specified | Azure | |
| 8 | Not specified | Azure | |
| 9 | Not specified | Azure |
Bind the column to the enum property; the filter offers the enum values, and you can use Description attributes for friendly labels.
Radzen Blazor Components, © 2018-2026 Radzen.
Source Code licensed under
MIT