Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set column title by using DisplayAttribute and DisplayNameAttribute #588

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Eleve2023
Copy link

This code uses the DisplayName and Display attributes to obtain the display name of a property. It starts by getting the member information from the provided member expression using the Member property of the memberExpression object. Then, it uses the GetCustomAttribute method to get the DisplayName and Display attributes associated with this member. If the DisplayName attribute is present, its value is used as the title. Otherwise, if the Display attribute is present, its Name property is used as the title. If neither of these attributes is present, the name of the member itself is used as the title. Finally, the value of the title is assigned to the Title property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant