From f24d19842eeaec80f21d4bf5cee1924541198087 Mon Sep 17 00:00:00 2001 From: Vincent Uhlmann Date: Tue, 7 Oct 2025 11:16:36 +0200 Subject: [PATCH] Update note on field attributes in ObservableProperty Clarified note about field attributes and custom attributes in generated properties. --- docs/mvvm/generators/ObservableProperty.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/mvvm/generators/ObservableProperty.md b/docs/mvvm/generators/ObservableProperty.md index 2125ca852..52430db53 100644 --- a/docs/mvvm/generators/ObservableProperty.md +++ b/docs/mvvm/generators/ObservableProperty.md @@ -200,7 +200,7 @@ public string? Name That generated `ValidateProperty` call will then validate the property and update the state of the `ObservableValidator` object, so that UI components can react to it and display any validation errors appropriately. > [!NOTE] -> By design, only field attributes that inherit from [`ValidationAttribute`](/dotnet/api/system.componentmodel.dataannotations.validationattribute) will be forwarded to the generated property. This is done specifically to support data validation scenarios. All other field attributes will be ignored, so it is not currently possible to add additional custom attributes on a field and have them also be applied to the generated property. If that is required (eg. to control serialization), consider using a traditional manual property instead. +> By design, only field attributes that inherit from [`ValidationAttribute`](/dotnet/api/system.componentmodel.dataannotations.validationattribute) will be forwarded to the generated property. This is done specifically to support data validation scenarios. All other field attributes will be ignored. If this is required (eg. to control serialization), refer to the [Adding custom attributes](#adding-custom-attributes) section. ## Sending notification messages