GeneratedStyledPropertyAttribute Class
Definition
Instructs the Avalonia property source generator to emit a Avalonia.StyledProperty<T> registration and accessor bodies for the annotated partial property.
public class GeneratedStyledPropertyAttribute
Remarks
Apply to a partial instance property with both get and set accessors,
declared on a partial class deriving from Avalonia.AvaloniaObject.
Constructors
| Name | Description |
|---|---|
| GeneratedStyledPropertyAttribute | No summary available. |
GeneratedStyledPropertyAttribute Constructor
public GeneratedStyledPropertyAttribute()
Properties
| Name | Description |
|---|---|
| AddOwnerFrom | Re-owns an existing styled property from the specified base type instead of registering a new property. The source property must be a static {Name}Property member of the given type. Metadata may still be overridden with Avalonia.GeneratedStyledPropertyAttribute.DefaultValue, Avalonia.GeneratedStyledPropertyAttribute.DefaultBindingMode and Avalonia.GeneratedStyledPropertyAttribute.CoerceMethodName. |
| CoerceMethodName | The name of the coercion method, with signature static T {Method}(AvaloniaObject sender, T value). Declare it as an private static method on the same type. |
| DefaultBindingMode | The default binding mode for the property. |
| DefaultValue | The default value of the property. Must be a compile-time constant. For non-constant defaults, call {Name}Property.OverrideDefaultValue(...) in a static constructor instead. |
| EnableDataValidation | Whether the property is interested in data validation. |
| Inherits | Whether the property inherits its value down the logical tree. |
| ValidateMethodName | The name of the validation method, with signature static bool {Method}(T value). Declare it as an private static method on the same type. |
AddOwnerFrom Property
Re-owns an existing styled property from the specified base type instead of registering a new property.
The source property must be a static {Name}Property member of the given type.
Metadata may still be overridden with Avalonia.GeneratedStyledPropertyAttribute.DefaultValue, Avalonia.GeneratedStyledPropertyAttribute.DefaultBindingMode and Avalonia.GeneratedStyledPropertyAttribute.CoerceMethodName.
public Type AddOwnerFrom { get; set; }
CoerceMethodName Property
The name of the coercion method, with signature
static T {Method}(AvaloniaObject sender, T value).
Declare it as an private static method on the same type.
public string CoerceMethodName { get; set; }
DefaultBindingMode Property
The default binding mode for the property.
public Avalonia.Data.BindingMode DefaultBindingMode { get; set; }
DefaultValue Property
The default value of the property. Must be a compile-time constant.
For non-constant defaults, call {Name}Property.OverrideDefaultValue(...) in a static constructor instead.
public object DefaultValue { get; set; }
EnableDataValidation Property
Whether the property is interested in data validation.
public bool EnableDataValidation { get; set; }
Inherits Property
Whether the property inherits its value down the logical tree.
public bool Inherits { get; set; }
Remarks
Cannot be used with Avalonia.GeneratedStyledPropertyAttribute.AddOwnerFrom.
ValidateMethodName Property
The name of the validation method, with signature
static bool {Method}(T value).
Declare it as an private static method on the same type.
public string ValidateMethodName { get; set; }
Remarks
Cannot be used with Avalonia.GeneratedStyledPropertyAttribute.AddOwnerFrom.