GeneratedAttachedPropertyAttribute Class
Definition
Instructs the Avalonia property source generator to emit an Avalonia.AttachedProperty<T>
registration and accessor methods for the annotated partial Get method.
public class GeneratedAttachedPropertyAttribute
Remarks
Apply to a static partial T Get{Name}(THost element) method declared on a partial class.
Constructors
| Name | Description |
|---|---|
| GeneratedAttachedPropertyAttribute | No summary available. |
GeneratedAttachedPropertyAttribute Constructor
public GeneratedAttachedPropertyAttribute()
Properties
| Name | Description |
|---|---|
| AddOwnerFrom | Re-owns an existing attached 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.GeneratedAttachedPropertyAttribute.DefaultValue, Avalonia.GeneratedAttachedPropertyAttribute.DefaultBindingMode and Avalonia.GeneratedAttachedPropertyAttribute.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. |
| 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). Pass via nameof(...). Declare it as an private static method on the same type. |
AddOwnerFrom Property
Re-owns an existing attached 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.GeneratedAttachedPropertyAttribute.DefaultValue, Avalonia.GeneratedAttachedPropertyAttribute.DefaultBindingMode and Avalonia.GeneratedAttachedPropertyAttribute.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; }
Inherits Property
Whether the property inherits its value down the logical tree.
public bool Inherits { get; set; }
Remarks
Cannot be used with Avalonia.GeneratedAttachedPropertyAttribute.AddOwnerFrom.
ValidateMethodName Property
The name of the validation method, with signature
static bool {Method}(T value). Pass via nameof(...).
Declare it as an private static method on the same type.
public string ValidateMethodName { get; set; }
Remarks
Cannot be used with Avalonia.GeneratedAttachedPropertyAttribute.AddOwnerFrom.