Freigeben über


BindableProperty.Create Method

Definition

Creates a new instance of the BindableProperty class.

public static Microsoft.Maui.Controls.BindableProperty Create (string propertyName, Type returnType, Type declaringType, object defaultValue = default, Microsoft.Maui.Controls.BindingMode defaultBindingMode = Microsoft.Maui.Controls.BindingMode.OneWay, Microsoft.Maui.Controls.BindableProperty.ValidateValueDelegate validateValue = default, Microsoft.Maui.Controls.BindableProperty.BindingPropertyChangedDelegate propertyChanged = default, Microsoft.Maui.Controls.BindableProperty.BindingPropertyChangingDelegate propertyChanging = default, Microsoft.Maui.Controls.BindableProperty.CoerceValueDelegate coerceValue = default, Microsoft.Maui.Controls.BindableProperty.CreateDefaultValueDelegate defaultValueCreator = default);
static member Create : string * Type * Type * obj * Microsoft.Maui.Controls.BindingMode * Microsoft.Maui.Controls.BindableProperty.ValidateValueDelegate * Microsoft.Maui.Controls.BindableProperty.BindingPropertyChangedDelegate * Microsoft.Maui.Controls.BindableProperty.BindingPropertyChangingDelegate * Microsoft.Maui.Controls.BindableProperty.CoerceValueDelegate * Microsoft.Maui.Controls.BindableProperty.CreateDefaultValueDelegate -> Microsoft.Maui.Controls.BindableProperty
Public Shared Function Create (propertyName As String, returnType As Type, declaringType As Type, Optional defaultValue As Object = Nothing, Optional defaultBindingMode As BindingMode = Microsoft.Maui.Controls.BindingMode.OneWay, Optional validateValue As BindableProperty.ValidateValueDelegate = Nothing, Optional propertyChanged As BindableProperty.BindingPropertyChangedDelegate = Nothing, Optional propertyChanging As BindableProperty.BindingPropertyChangingDelegate = Nothing, Optional coerceValue As BindableProperty.CoerceValueDelegate = Nothing, Optional defaultValueCreator As BindableProperty.CreateDefaultValueDelegate = Nothing) As BindableProperty

Parameters

propertyName
String

The name of the BindableProperty.

returnType
Type

The type of the property.

declaringType
Type

The type of the declaring object.

defaultValue
Object

The default value for the property.

defaultBindingMode
BindingMode

The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.

validateValue
BindableProperty.ValidateValueDelegate

A delegate to be run when a value is set. This parameter is optional. Default is null.

propertyChanged
BindableProperty.BindingPropertyChangedDelegate

A delegate to be run when the value has changed. This parameter is optional. Default is null.

propertyChanging
BindableProperty.BindingPropertyChangingDelegate

A delegate to be run when the value will change. This parameter is optional. Default is null.

coerceValue
BindableProperty.CoerceValueDelegate

A delegate used to coerce the range of a value. This parameter is optional. Default is null.

defaultValueCreator
BindableProperty.CreateDefaultValueDelegate

A Func used to initialize default value for reference types.

Returns

A newly created BindableProperty.

Applies to