Xamarin.Forms Guides | Samples

Xamarin.Forms.BindableProperty.CreateAttachedReadOnly Method

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

Syntax

public static BindablePropertyKey CreateAttachedReadOnly (String propertyName, Type returnType, Type declaringType, Object defaultValue, BindingMode defaultBindingMode, BindableProperty+ValidateValueDelegate validateValue, BindableProperty+BindingPropertyChangedDelegate propertyChanged, BindableProperty+BindingPropertyChangingDelegate propertyChanging, BindableProperty+CoerceValueDelegate coerceValue, BindableProperty+CreateDefaultValueDelegate defaultValueCreator)

Parameters

propertyName
The name of the BindableProperty.
returnType
The type of the property.
declaringType
The type of the declaring object.
defaultValue
The default value for the property.
defaultBindingMode
The BindingMode to use on SetBinding() if no BindingMode is given. This parameter is optional. Default is BindingMode.OneWay.
validateValue
A delegate to be run when a value is set. This parameter is optional. Default is null.
propertyChanged
A delegate to be run when the value has changed. This parameter is optional. Default is null.
propertyChanging
A delegate to be run when the value will change. This parameter is optional. Default is null.
coerceValue
A delegate used to coerce the range of a value. This parameter is optional. Default is null.
defaultValueCreator
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.

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.2.2.0, 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0