BindingValueT Structure

A value passed into a binding.

Definition

Namespace: Avalonia.Data
Assembly: Avalonia.Base (in Avalonia.Base.dll) Version: 11.3.999
public readonly struct BindingValue<T> : IEquatable<BindingValue<T>>
Inheritance
Object    ValueType    BindingValueT
Implements
IEquatableBindingValueT

Type Parameters

T
The value type.

Remarks

The avalonia binding system is typed, and as such additional state is stored in this structure. A binding value can be in a number of states, described by the Type property: - Value: a simple value - UnsetValue: the target property will revert to its unbound state until a new binding value is produced. Represented by UnsetValue in an untyped context - DoNothing: the binding value will be ignored. Represented by DoNothing in an untyped context - BindingError: a binding error, such as a missing source property, with an optional fallback value - DataValidationError: a data validation error, with an optional fallback value To create a new binding value you can: - For a simple value, call the BindingValueT constructor or use an implicit conversion from T - For an unset value, use Unset or simply `default` - For other types, call one of the static factory methods

Properties

DoNothing Returns a binding value with a type of DoNothing.
Error Gets the binding or data validation error.
HasError Gets a value indicating whether the binding value represents either a binding or data validation error.
HasValue Gets a value indicating whether the binding value has a value.
Type Gets the type of the binding value.
Unset Returns a binding value with a type of UnsetValue.
Value Gets the binding value or fallback value.

Methods

BindingError(Exception) Returns a binding value with a type of BindingError.
BindingError(Exception, T) Returns a binding value with a type of BindingErrorWithFallback.
BindingError(Exception, OptionalT) Returns a binding value with a type of BindingError or BindingErrorWithFallback.
DataValidationError(Exception) Returns a binding value with a type of DataValidationError.
DataValidationError(Exception, T) Returns a binding value with a type of DataValidationErrorWithFallback.
DataValidationError(Exception, OptionalT) Returns a binding value with a type of DataValidationError or DataValidationErrorWithFallback.
FromUntyped(Object) Creates a BindingValueT from an object, handling the special values UnsetValue, DoNothing and BindingNotification.
FromUntyped(Object, Type) Creates a BindingValueT from an object, handling the special values UnsetValue, DoNothing and BindingNotification.
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetValueOrDefault Gets the value of the binding value if present, otherwise the default value.
GetValueOrDefault(T) Gets the value of the binding value if present, otherwise a default value.
GetValueOrDefaultTResult Gets the value if present, otherwise the default value.
GetValueOrDefaultTResult(TResult) Gets the value of the binding value if present, otherwise a default value.
ToOptional Converts the binding value to an OptionalT.
ToStringReturns the fully qualified type name of this instance.
(Overrides ValueTypeToString)
ToUntyped Converts the value to untyped representation, using UnsetValue, DoNothing and BindingNotification where appropriate.
WithValue(T) Returns a new binding value with the specified value.

Operators

(T to BindingValueT) Creates a binding value from an instance of the underlying value type.
(OptionalT to BindingValueT) Creates a binding value from an OptionalT.

See Also