-
Notifications
You must be signed in to change notification settings - Fork 25.1k
[11.0 P1] Forms on BLazor support DisplayName attribute
#36438
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
base: main
Are you sure you want to change the base?
Conversation
guardrex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ilonatommy ... Approving with tiny NITs.
I'll take care of the release notes. I'll ping you on that PR when it goes up within the next few days.
| public DateTime ProductionDate { get; set; } | ||
| ``` | ||
|
|
||
| [`[DisplayName]` attribute](xref:System.ComponentModel.DisplayNameAttribute) is also supported: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| [`[DisplayName]` attribute](xref:System.ComponentModel.DisplayNameAttribute) is also supported: | |
| The [`[DisplayName]` attribute](xref:System.ComponentModel.DisplayNameAttribute) is also supported: |
| public DateTime ProductionDate { get; set; } | ||
| ``` | ||
|
|
||
| Between the two approaches, the `[Display]` attribute is recommended, which makes additional properties available. The `[Display]` attribute also enables assigning a resource type for localization. When both attributes are present, `[Display]` takes precedence over `[DisplayName]`. If neither attribute is present, the component falls back to the property name itself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Between the two approaches, the `[Display]` attribute is recommended, which makes additional properties available. The `[Display]` attribute also enables assigning a resource type for localization. When both attributes are present, `[Display]` takes precedence over `[DisplayName]`. If neither attribute is present, the component falls back to the property name itself. | |
| Between the two approaches, the `[Display]` attribute is recommended, which makes additional properties available. The `[Display]` attribute also enables assigning a resource type for localization. When both attributes are present, `[Display]` takes precedence over `[DisplayName]`. If neither attribute is present, the component falls back to the property name. |
| :::moniker range=">= aspnetcore-11.0" | ||
|
|
||
| --> | ||
| The <xref:Microsoft.AspNetCore.Components.Forms.DisplayName%601> component can be used to display property names from metadata attributes. The [`[Display]` attribute](xref:System.ComponentModel.DataAnnotations.DisplayAttribute) on the model class property is supported: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other little problem here: The first line refers to the DisplayName component, but the second refers to the [Display] attribute. The component isn't covered until the end of the added content. Should that line be moved down here?
... OR ...
Since the component is mentioned in the paragraph on Line 479, should the component example at the bottom be moved to the top of this added content?
Doc changes proposal for dotnet/aspnetcore#64636.
Issue: dotnet/aspnetcore#49147
Internal previews