AvaloniaPropertyRegisterTOwner, TValue Method

Registers a AvaloniaProperty.

Definition

Namespace: Avalonia
Assembly: Avalonia.Base (in Avalonia.Base.dll) Version: 11.3.999
public static StyledProperty<TValue> Register<TOwner, TValue>(
	string name,
	TValue defaultValue = null,
	bool inherits = false,
	BindingMode defaultBindingMode = BindingMode.OneWay,
	Func<TValue, bool>? validate = null,
	Func<AvaloniaObject, TValue, TValue>? coerce = null,
	bool enableDataValidation = false
)
where TOwner : AvaloniaObject

Parameters

name  String
The name of the property.
defaultValue  TValue  (Optional)
The default value of the property.
inherits  Boolean  (Optional)
Whether the property inherits its value.
defaultBindingMode  BindingMode  (Optional)
The default binding mode for the property.
validate  FuncTValue, Boolean  (Optional)
A value validation callback.
coerce  FuncAvaloniaObject, TValue, TValue  (Optional)
A value coercion callback.
enableDataValidation  Boolean  (Optional)
Whether the property is interested in data validation.

Type Parameters

TOwner
The type of the class that is registering the property.
TValue
The type of the property's value.

Return Value

StyledPropertyTValue
A StyledPropertyTValue

See Also