WindowsCommunityToolkit icon indicating copy to clipboard operation
WindowsCommunityToolkit copied to clipboard

Add Custom Attribute Support for Properties Auto-Generated by [ObservableProperty]

Open Lwc-LiuWenCheng opened this issue 5 months ago • 1 comments

Describe the problem

I propose adding support for custom attributes on properties auto-generated by the [ObservableProperty] in the .NET Community Toolkit. Currently, properties auto-generated using [ObservableProperty] do not support attaching additional attributes directly, limiting their application in scenarios like data validation or UI mapping.

Describe the solution

When using [ObservableProperty], there should be a way to attach additional attributes to the generated properties, rather than manually writing out the full properties. In many cases, we need to attach specific attributes to properties of a data model for data validation, serialization control, or specific UI behaviors. For instance, we might want to use [DataAnnotations] attributes for validating data models, or custom attributes to control how columns are displayed.

Alternatives

No response

Additional info

No response

Help us help you

None

Lwc-LiuWenCheng avatar Feb 05 '24 07:02 Lwc-LiuWenCheng