[QuickGrid] Set column title by using DataAnnotations.DisplayAttribute
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
## Summary
In the Microsoft.Fast.Components.FluentUI package I'm using a QuickGrid copy that is extended to define a column title by using the `System.ComponentModel.DataAnnotations.DisplayAttribute` on the property you want to display in a column (instead of specifying a `Title` parameter on the `TemplateColumn` or `PropertyColumn`)
## Motivation and goals
- Attribute can load data from a resource file which makes localization easier
- Potentially this can later also be used for auto generating columns by leveraging the `Order` (and other) properties
-
## In scope
- Add the necessary code to enable this
## Out of scope
- Auto generating colums
## Risks / unknowns
Risk is low as the original Title parameter is kept in place. This just offers an alternative way of setting a column's title. Need to document what option gets precedence over the other
## Examples
For example code and implementation see the Razor tab at https://brave-cliff-0c0c93310.azurestaticapps.net/DataGrid#column-headers
## Alternative approach
We could also use `DisplayName` attribute (from `System.ComponentModel`) to be able to specify a title on a property but we would lose the option to read from a resource file with that. Also, this approach would not help with a possible auto generation scenario later (no Order or other properties).
Contributor guide
Research direction
Start by reviewing QuickGrid's existing column title handling and the example implementation linked in the issue. The work is done when DisplayAttribute can provide a localized column title without removing the existing Title parameter, and the precedence between the two options is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 44/100