BindingNotification Class
Definition
Represents a binding notification that can be a valid binding value, or a binding or data validation error.
public class BindingNotification
Remarks
This class is very similar to Avalonia.Data.BindingValue<T>, but where Avalonia.Data.BindingValue<T> is used by typed bindings, this class is used to hold binding and data validation errors in untyped bindings. As Avalonia moves towards using typed bindings by default we may want to remove this class.
Constructors
| Name | Description |
|---|---|
| BindingNotification (3 overloads) | Initializes a new instance of the Avalonia.Data.BindingNotification class. |
BindingNotification overloads
BindingNotification Constructor
Initializes a new instance of the Avalonia.Data.BindingNotification class.
public BindingNotification(Exception error, Avalonia.Data.BindingErrorType errorType)
Parameters
error Exception
The binding error.
errorType Avalonia.Data.BindingErrorType
The type of the binding error.
BindingNotification Constructor
Initializes a new instance of the Avalonia.Data.BindingNotification class.
public BindingNotification(Exception error, Avalonia.Data.BindingErrorType errorType, object fallbackValue)
Parameters
error Exception
The binding error.
errorType Avalonia.Data.BindingErrorType
The type of the binding error.
fallbackValue object
The fallback value.
BindingNotification Constructor
Initializes a new instance of the Avalonia.Data.BindingNotification class.
public BindingNotification(object value)
Parameters
value object
The binding value.
Methods
| Name | Description |
|---|---|
| AddError | Adds an error to the Avalonia.Data.BindingNotification. |
| ClearValue | Removes the Avalonia.Data.BindingNotification.Value and makes Avalonia.Data.BindingNotification.HasValue return null. |
| Equals (2 overloads) | Compares a value to an instance of Avalonia.Data.BindingNotification for equality. |
| ExtractError | Gets an exception from an object that may be a Avalonia.Data.BindingNotification. |
| ExtractValue | Gets a value from an object that may be a Avalonia.Data.BindingNotification. |
| GetHashCode | Gets the hash code for this instance of Avalonia.Data.BindingNotification. |
| SetValue | Sets the Avalonia.Data.BindingNotification.Value. |
| ToString | No summary available. |
| UpdateValue | Updates the value of an object that may be a Avalonia.Data.BindingNotification. |
AddError Method
Adds an error to the Avalonia.Data.BindingNotification.
public void AddError(Exception e, Avalonia.Data.BindingErrorType type)
Parameters
e Exception
The error to add.
type Avalonia.Data.BindingErrorType
The error type.
ClearValue Method
Removes the Avalonia.Data.BindingNotification.Value and makes Avalonia.Data.BindingNotification.HasValue return null.
public void ClearValue()
Equals overloads
Equals Method
Compares a value to an instance of Avalonia.Data.BindingNotification for equality.
public bool Equals(Avalonia.Data.BindingNotification other)
Parameters
other Avalonia.Data.BindingNotification
The value to compare.
Returns
bool
true if the two instances are equal; otherwise false.
Equals Method
Compares an object to an instance of Avalonia.Data.BindingNotification for equality.
public bool Equals(object obj)
Parameters
obj object
The object to compare.
Returns
bool
true if the two instances are equal; otherwise false.
ExtractError Method
Gets an exception from an object that may be a Avalonia.Data.BindingNotification.
public object ExtractError(object o)
Parameters
o object
The object.
Returns
object
The value.
Remarks
If o is a Avalonia.Data.BindingNotification then returns the binding
notification's Avalonia.Data.BindingNotification.Error. If not, returns the object unchanged.
ExtractValue Method
Gets a value from an object that may be a Avalonia.Data.BindingNotification.
public object ExtractValue(object o)
Parameters
o object
The object.
Returns
object
The value.
Remarks
If o is a Avalonia.Data.BindingNotification then returns the binding
notification's Avalonia.Data.BindingNotification.Value. If not, returns the object unchanged.
GetHashCode Method
Gets the hash code for this instance of Avalonia.Data.BindingNotification.
public int GetHashCode()
Returns
int
A hash code.
SetValue Method
Sets the Avalonia.Data.BindingNotification.Value.
public void SetValue(object value)
Parameters
value object
ToString Method
public string ToString()
Returns
string
UpdateValue Method
Updates the value of an object that may be a Avalonia.Data.BindingNotification.
public object UpdateValue(object o, object value)
Parameters
o object
The object that may be a binding notification.
value object
The new value.
Returns
object
The updated binding notification if o is a binding notification;
otherwise value.
Remarks
If o is a Avalonia.Data.BindingNotification then sets its value
to value. If value is a
Avalonia.Data.BindingNotification then the value will first be extracted.
Properties
| Name | Description |
|---|---|
| Error | Gets the error that occurred on the source, if any. |
| ErrorType | Gets the type of error that Avalonia.Data.BindingNotification.Error represents, if any. |
| HasValue | Gets a value indicating whether Avalonia.Data.BindingNotification.Value should be pushed to the target. |
| Value | Gets the value that should be passed to the target when Avalonia.Data.BindingNotification.HasValue is true. |
Error Property
Gets the error that occurred on the source, if any.
public Exception Error { get; set; }
ErrorType Property
Gets the type of error that Avalonia.Data.BindingNotification.Error represents, if any.
public Avalonia.Data.BindingErrorType ErrorType { get; set; }
HasValue Property
Gets a value indicating whether Avalonia.Data.BindingNotification.Value should be pushed to the target.
public bool HasValue { get; set; }
Value Property
Gets the value that should be passed to the target when Avalonia.Data.BindingNotification.HasValue is true.
public object Value { get; set; }
Remarks
If this property is read when Avalonia.Data.BindingNotification.HasValue is false then it will return Avalonia.AvaloniaProperty.UnsetValue.
Fields
| Name | Description |
|---|---|
| Null | A binding notification representing the null value. |
| UnsetValue | A binding notification representing Avalonia.AvaloniaProperty.UnsetValue. |
Null Field
A binding notification representing the null value.
public Avalonia.Data.BindingNotification Null
UnsetValue Field
A binding notification representing Avalonia.AvaloniaProperty.UnsetValue.
public Avalonia.Data.BindingNotification UnsetValue