AvaloniaProperty.

Register<TOwner, TValue>(string, TValue, bool, BindingMode, Func<TValue, bool>, Func<IAvaloniaObject, TValue, TValue>, Action<IAvaloniaObject, bool>) Method

Summary

Registers a AvaloniaProperty.
Namespace
Avalonia
Containing Type
AvaloniaProperty

Syntax

public static StyledProperty<TValue> Register<TOwner, TValue>(string name, TValue defaultValue = default(TValue), bool inherits = false, BindingMode defaultBindingMode = OneWay, Func<TValue, bool> validate = null, Func<IAvaloniaObject, TValue, TValue> coerce = null, Action<IAvaloniaObject, bool> notifying = null) 
    where TOwner : IAvaloniaObject

Type Parameters

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

Parameters

Name Type Description
name string The name of the property.
defaultValue TValue The default value of the property.
inherits bool Whether the property inherits its value.
defaultBindingMode BindingMode The default binding mode for the property.
validate Func<TValue, bool> A value validation callback.
coerce Func<IAvaloniaObject, TValue, TValue> A value coercion callback.
notifying Action<IAvaloniaObject, bool> A method that gets called before and after the property starts being notified on an object; the bool argument will be true before and false afterwards. This callback is intended to support IsDataContextChanging.

Return Value

Type Description
StyledProperty<TValue> A StyledProperty<TValue>