Binding.Create<TSource,TProperty> Method

Definition

This factory method was added to simplify creating TypedBindingBase instances from lambda getters.

public static Microsoft.Maui.Controls.BindingBase Create<TSource,TProperty> (Func<TSource,TProperty> getter, Microsoft.Maui.Controls.BindingMode mode = Microsoft.Maui.Controls.BindingMode.Default, Microsoft.Maui.Controls.IValueConverter? converter = default, object? converterParameter = default, string? stringFormat = default, object? source = default, object? fallbackValue = default, object? targetNullValue = default);
static member Create : Func<'Source, 'Property> * Microsoft.Maui.Controls.BindingMode * Microsoft.Maui.Controls.IValueConverter * obj * string * obj * obj * obj -> Microsoft.Maui.Controls.BindingBase
Public Shared Function Create(Of TSource, TProperty) (getter As Func(Of TSource, TProperty), Optional mode As BindingMode = Microsoft.Maui.Controls.BindingMode.Default, Optional converter As IValueConverter = Nothing, Optional converterParameter As Object = Nothing, Optional stringFormat As String = Nothing, Optional source As Object = Nothing, Optional fallbackValue As Object = Nothing, Optional targetNullValue As Object = Nothing) As BindingBase

Type Parameters

TSource

The source type.

TProperty

The property type.

Parameters

getter
Func<TSource,TProperty>

An getter method used to retrieve the source property.

mode
BindingMode

The binding mode. This property is optional. Default is Default.

converter
IValueConverter

The converter. This parameter is optional. Default is null.

converterParameter
Object

An user-defined parameter to pass to the converter. This parameter is optional. Default is null.

stringFormat
String

A String format. This parameter is optional. Default is null.

source
Object

An object used as the source for this binding. This parameter is optional. Default is null.

fallbackValue
Object

The value to use instead of the default value for the property, if no specified value exists.

targetNullValue
Object

The value to supply for a bound property when the target of the binding is null.

Returns

Exceptions

Applies to