Table of Contents

Class BindingBase

Namespace
Avalonia.Data
Assembly
Avalonia.Markup.dll
public abstract class BindingBase : IBinding
Inheritance
BindingBase
Implements
Derived
Inherited Members

Constructors

BindingBase()

Initializes a new instance of the Binding class.

public BindingBase()

BindingBase(BindingMode)

Initializes a new instance of the Binding class.

public BindingBase(BindingMode mode = BindingMode.Default)

Parameters

mode BindingMode

The binding mode.

Properties

Converter

Gets or sets the IValueConverter to use.

public IValueConverter? Converter { get; set; }

Property Value

IValueConverter

ConverterCulture

Gets or sets the culture in which to evaluate the converter.

[TypeConverter(typeof(CultureInfoIetfLanguageTagConverter))]
public CultureInfo? ConverterCulture { get; set; }

Property Value

CultureInfo

The default value is null.

Remarks

If this property is not set then CurrentCulture will be used.

ConverterParameter

Gets or sets a parameter to pass to Converter.

public object? ConverterParameter { get; set; }

Property Value

object

DefaultAnchor

public WeakReference? DefaultAnchor { get; set; }

Property Value

WeakReference

Delay

Gets or sets the amount of time, in milliseconds, to wait before updating the binding source after the value on the target changes.

public int Delay { get; set; }

Property Value

int

Remarks

There is no delay when the source is updated via LostFocus or UpdateSource(). Nor is there a delay when OneWayToSource is active and a new source object is provided.

FallbackValue

Gets or sets the value to use when the binding is unable to produce a value.

public object? FallbackValue { get; set; }

Property Value

object

Mode

Gets or sets the binding mode.

public BindingMode Mode { get; set; }

Property Value

BindingMode

NameScope

public WeakReference<INameScope?>? NameScope { get; set; }

Property Value

WeakReference<INameScope>

Priority

Gets or sets the binding priority.

public BindingPriority Priority { get; set; }

Property Value

BindingPriority

StringFormat

Gets or sets the string format.

public string? StringFormat { get; set; }

Property Value

string

TargetNullValue

Gets or sets the value to use when the binding result is null.

public object? TargetNullValue { get; set; }

Property Value

object

UpdateSourceTrigger

Gets or sets a value that determines the timing of binding source updates for TwoWay and OneWayToSource bindings.

public UpdateSourceTrigger UpdateSourceTrigger { get; set; }

Property Value

UpdateSourceTrigger

Methods

Initiate(AvaloniaObject, AvaloniaProperty?, object?, bool)

Initiates the binding on a target object.

[Obsolete("This API may be removed in Avalonia 12. If you depend on this API, please open an issue with details of your use-case.")]
public abstract InstancedBinding? Initiate(AvaloniaObject target, AvaloniaProperty? targetProperty, object? anchor = null, bool enableDataValidation = false)

Parameters

target AvaloniaObject

The target instance.

targetProperty AvaloniaProperty

The target property. May be null.

anchor object

An optional anchor from which to locate required context. When binding to objects that are not in the logical tree, certain types of binding need an anchor into the tree in order to locate named controls or resources. The anchor parameter can be used to provide this context.

enableDataValidation bool

Whether data validation should be enabled.

Returns

InstancedBinding

A InstancedBinding or null if the binding could not be resolved.