Register<TOwner, TValue> Method
Registers a AvaloniaProperty.
Definition
Namespace: Avalonia
Assembly: Avalonia.Base (in Avalonia.Base.dll)
- C#
- VB
- F#
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
Public Shared Function Register(Of TOwner As AvaloniaObject, TValue) (
name As String,
Optional defaultValue As TValue = Nothing,
Optional inherits As Boolean = false,
Optional defaultBindingMode As BindingMode = BindingMode.OneWay,
Optional validate As Func(Of TValue, Boolean) = Nothing,
Optional coerce As Func(Of AvaloniaObject, TValue, TValue) = Nothing,
Optional enableDataValidation As Boolean = false
) As StyledProperty(Of TValue)
static member Register :
name : string *
?defaultValue : 'TValue *
?inherits : bool *
?defaultBindingMode : BindingMode *
?validate : Func<'TValue, bool> *
?coerce : Func<AvaloniaObject, 'TValue, 'TValue> *
?enableDataValidation : bool
(* Defaults:
let _defaultValue = defaultArg defaultValue null
let _inherits = defaultArg inherits false
let _defaultBindingMode = defaultArg defaultBindingMode BindingMode.OneWay
let _validate = defaultArg validate null
let _coerce = defaultArg coerce null
let _enableDataValidation = defaultArg enableDataValidation false
*)
-> StyledProperty<'TValue> when 'TOwner : 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.
- Boolean (Optional)
- Whether the property is interested in data validation.
Type Parameters
- The type of the class that is registering the property.
- The type of the property's value.
Return Value
StyledProperty(TValue)
A StyledProperty(TValue)