[PR #455] Add Display Attribute and localization for Enum Filter #2186

Open
opened 2026-01-29 18:17:38 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/radzenhq/radzen-blazor/pull/455

State: closed
Merged: Yes


Continues on PR #435
We can now use the built-in Display attribute to manipulate the Enum Description. For example:

public enum ColorType
{
        Red,
        Green,
        Blue,
        [Display(Description = "Almond Green")]
        AlmondGreen,
        [Display(Description = "Amber Gray")]
        AmberGray,
        [Display(Description = "Apple Blue... ")]
        AppleBlueSeaGreen,
        //[Display(Description = "Miss", ResourceType = typeof(ResourceFile)] localization example
        [Display(Description = "Azure")]
        AzureBlue,
}

This PR does not introduce breaking changes, it's an opt-in to localise the enum values in the filter or give a nicer description while keeping the API simple.

<RadzenDataGridColumn TItem="Employee" Property="Color" Title="Favorite Color (Display Attribute in Filter)" />
Screenshot 2022-05-11 at 15 11 35
**Original Pull Request:** https://github.com/radzenhq/radzen-blazor/pull/455 **State:** closed **Merged:** Yes --- Continues on PR #435 We can now use the built-in Display attribute to manipulate the Enum Description. For example: ```cs public enum ColorType { Red, Green, Blue, [Display(Description = "Almond Green")] AlmondGreen, [Display(Description = "Amber Gray")] AmberGray, [Display(Description = "Apple Blue... ")] AppleBlueSeaGreen, //[Display(Description = "Miss", ResourceType = typeof(ResourceFile)] localization example [Display(Description = "Azure")] AzureBlue, } ``` This PR does not introduce breaking changes, it's an opt-in to localise the enum values in the filter or give a nicer description while keeping the API simple. ```razor <RadzenDataGridColumn TItem="Employee" Property="Color" Title="Favorite Color (Display Attribute in Filter)" /> ``` <img width="1637" alt="Screenshot 2022-05-11 at 15 11 35" src="https://user-images.githubusercontent.com/10981553/167858143-4fc016bc-6582-47d2-8e36-6872c93e0237.png">
claunia added the pull-request label 2026-01-29 18:17:38 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#2186