Udostępnij przez


BindableProperty.CreateAttachedReadOnly Metoda

Definicja

Tworzy nowe wystąpienie klasy BindableProperty dla dołączonych właściwości tylko do odczytu.

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

Parametry

propertyName
String

Nazwa właściwości BindableProperty.

returnType
Type

Typ właściwości.

declaringType
Type

Typ obiektu deklarowania.

defaultValue
Object

Wartość domyślna właściwości .

defaultBindingMode
BindingMode

Tryb BindingMode do użycia w funkcji SetBinding(), jeśli nie podano metody BindingMode. Ten parametr jest opcjonalny. Wartość domyślna to BindingMode.OneWay.

validateValue
BindableProperty.ValidateValueDelegate

Delegat do uruchomienia po ustawieniu wartości. Ten parametr jest opcjonalny. Wartość domyślna to null.

propertyChanged
BindableProperty.BindingPropertyChangedDelegate

Delegat do uruchomienia po zmianie wartości. Ten parametr jest opcjonalny. Wartość domyślna to null.

propertyChanging
BindableProperty.BindingPropertyChangingDelegate

Delegat, który ma zostać uruchomiony, gdy wartość zostanie zmieniona. Ten parametr jest opcjonalny. Wartość domyślna to null.

coerceValue
BindableProperty.CoerceValueDelegate

Delegat używany do przesyłania zakresu wartości. Ten parametr jest opcjonalny. Wartość domyślna to null.

defaultValueCreator
BindableProperty.CreateDefaultValueDelegate

Func używany do inicjowania wartości domyślnej dla typów odwołań.

Zwraca

Nowo utworzona dołączona właściwość BindableProperty tylko do odczytu.

Uwagi

Dołączone właściwości są właściwościami, które są powiązane z obiektem innym niż ich obiekt nadrzędny. Często są one używane w przypadku elementów podrzędnych w tabelach i siatkach, gdzie dane dotyczące lokalizacji elementu są przechowywane przez jego element nadrzędny, ale muszą być dostępne z poziomu samego elementu podrzędnego.

Dotyczy