DirectPropertyTOwner, TValueAddOwnerTNewOwner Method

Registers the direct property on another type.

Definition

Namespace: Avalonia
Assembly: Avalonia.Base (in Avalonia.Base.dll) Version: 11.3.999
public DirectProperty<TNewOwner, TValue> AddOwner<TNewOwner>(
	Func<TNewOwner, TValue> getter,
	Action<TNewOwner, TValue>? setter = null,
	TValue unsetValue = null,
	BindingMode defaultBindingMode = BindingMode.Default,
	bool enableDataValidation = false
)
where TNewOwner : AvaloniaObject

Parameters

getter  FuncTNewOwner, TValue
Gets the current value of the property.
setter  ActionTNewOwner, TValue  (Optional)
Sets the value of the property.
unsetValue  TValue  (Optional)
The value to use when the property is set to UnsetValue
defaultBindingMode  BindingMode  (Optional)
The default binding mode for the property.
enableDataValidation  Boolean  (Optional)
Whether the property is interested in data validation.

Type Parameters

TNewOwner
The type of the additional owner.

Return Value

DirectPropertyTNewOwner, TValue
The property.

See Also