Skip to main content

RegisterAttached<TOwner, THost, TValue>(String, TValue, Boolean, BindingMode, Func<TValue, Boolean>, Func<AvaloniaObject, TValue, TValue>) Method

Registers an attached AvaloniaProperty.

Definition

Namespace: Avalonia
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static AttachedProperty<TValue> RegisterAttached<TOwner, THost, TValue>(
string name,
TValue defaultValue = null,
bool inherits = false,
BindingMode defaultBindingMode = BindingMode.OneWay,
Func<TValue, bool>? validate = null,
Func<AvaloniaObject, TValue, TValue>? coerce = null
)
where THost : AvaloniaObject

Parameters

  String
The name of the property.
  TValue  (Optional)
The default value of the property.
  Boolean  (Optional)
Whether the property inherits its value.
  BindingMode  (Optional)
The default binding mode for the property.
  Func(TValue, Boolean)  (Optional)
A value validation callback.
  Func(AvaloniaObject, TValue, TValue)  (Optional)
A value coercion callback.

Type Parameters

The type of the class that is registering the property.
The type of the class that the property is to be registered on.
The type of the property's value.

Return Value

AttachedProperty(TValue)
A AvaloniaProperty(TValue)

See Also

Reference

AvaloniaProperty Class
RegisterAttached Overload
Avalonia Namespace