Aracılığıyla paylaş


BindableProperty.CreateAttachedReadOnly Method

Definition

Creates a new instance of the BindableProperty class for attached read-only properties.

public static Microsoft.Maui.Controls.BindablePropertyKey CreateAttachedReadOnly (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 CreateAttachedReadOnly : 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 CreateAttachedReadOnly (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

A newly created attached read-only BindableProperty.

Remarks

Attached properties are bindable properties that are bound to an object other than their parent. Often, they are used for child items in tables and grids, where data about the location of an item is maintained by its parent, but must be accessed from the child item itself.

Applies to