Udostępnij za pośrednictwem


BindableProperty.CreateReadOnly Method

Definition

Creates a new instance of the BindablePropertyKey class.

public static Microsoft.Maui.Controls.BindablePropertyKey CreateReadOnly (string propertyName, Type returnType, Type declaringType, object defaultValue, Microsoft.Maui.Controls.BindingMode defaultBindingMode = Microsoft.Maui.Controls.BindingMode.OneWayToSource, 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 CreateReadOnly : 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.BindablePropertyKey
Public Shared Function CreateReadOnly (propertyName As String, returnType As Type, declaringType As Type, defaultValue As Object, Optional defaultBindingMode As BindingMode = Microsoft.Maui.Controls.BindingMode.OneWayToSource, 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 BindablePropertyKey

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

Applies to