BindingValue<T> Structure
A value passed into a binding.
Definition
Namespace: Avalonia.Data
Assembly: Avalonia.Base (in Avalonia.Base.dll)
- C#
- VB
- F#
public readonly struct BindingValue<T> : IEquatable<BindingValue<T>>
Public Structure BindingValue(Of T)
Implements IEquatable(Of BindingValue(Of T))
[<SealedAttribute>]
type BindingValue<'T> =
struct
inherit ValueType
interface IEquatable<BindingValue<'T>>
end
Inheritance | Object → ValueType → BindingValue(T) |
Implements | IEquatable(BindingValue(T)) |
Type Parameters
- 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 BindingValue(T) 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
Constructors
BindingValue(T)(T) | Initializes a new instance of the BindingValue(T) struct with a type of Value |
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, Optional(T)) | 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, Optional(T)) | Returns a binding value with a type of DataValidationError or DataValidationErrorWithFallback. |
FromUntyped(Object) | Creates a BindingValue(T) from an object, handling the special values UnsetValue, DoNothing and BindingNotification. |
FromUntyped(Object, Type) | Creates a BindingValue(T) from an object, handling the special values UnsetValue, DoNothing and BindingNotification. |
GetType() | Gets 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. |
GetValueOrDefault(TResult)() | Gets the value if present, otherwise the default value. |
GetValueOrDefault(TResult)(TResult) | Gets the value of the binding value if present, otherwise a default value. |
ToOptional() | Converts the binding value to an Optional(T). |
ToString() | Returns the fully qualified type name of this instance. (Overrides ValueType.ToString()) |
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
Implicit(T to BindingValue(T)) | Creates a binding value from an instance of the underlying value type. |
Implicit(Optional(T) to BindingValue(T)) | Creates a binding value from an Optional(T). |