TypedBinding<TIn, TOut> Class
Definition
A binding whose input and output are strongly-typed.
public class TypedBinding<TIn, TOut>
Remarks
Avalonia.Experimental.Data.TypedBinding<T1, T2> represents a strongly-typed binding as opposed to Avalonia.Data.Binding which boxes value types. It is represented as a set of delegates:
- Avalonia.Experimental.Data.TypedBinding<T1, T2>.Read reads the value given a binding input
- Avalonia.Experimental.Data.TypedBinding<T1, T2>.Write writes a value given a binding input
- Avalonia.Experimental.Data.TypedBinding<T1, T2>.Links holds a collection of delegates which when passed a binding input
return each object traversed by Avalonia.Experimental.Data.TypedBinding<T1, T2>.Read. For example if Read is implemented
as
x => x.Foo.Bar.Bazthen there would be three links:x => x.Foo,x => x.Foo.Barandx => x.Foo.Bar.Baz. These links are used to subscribe to change notifications.
This class represents a binding which has not been instantiated on an object. When the Avalonia.Experimental.Data.TypedBinding<T1, T2>.Bind(Avalonia.AvaloniaObject,Avalonia.DirectPropertyBase{`1}) or Avalonia.Experimental.Data.TypedBinding<T1, T2>.Bind(Avalonia.AvaloniaObject,Avalonia.StyledProperty{`1}) methods are called, then an instance of Avalonia.Experimental.Data.Core.TypedBindingExpression<T1, T2> is created which represents the binding instantiated on that object.
Constructors
| Name | Description |
|---|---|
| TypedBinding<TIn, TOut> | No summary available. |
TypedBinding<TIn, TOut> Constructor
public TypedBinding<TIn, TOut>()
Methods
| Name | Description |
|---|---|
| Bind (2 overloads) | No summary available. |
| Instance | Instances the binding on a data source. |
Bind overloads
Bind Method
public IDisposable Bind(Avalonia.AvaloniaObject target, Avalonia.DirectPropertyBase<TOut> property)
Parameters
target Avalonia.AvaloniaObject
property Avalonia.DirectPropertyBase<TOut>
Returns
IDisposable
Bind Method
public IDisposable Bind(Avalonia.AvaloniaObject target, Avalonia.StyledProperty<TOut> property)
Parameters
target Avalonia.AvaloniaObject
property Avalonia.StyledProperty<TOut>
Returns
IDisposable
Instance Method
Instances the binding on a data source.
public Avalonia.Experimental.Data.Core.TypedBindingExpression<TIn,TOut><TIn, TOut> Instance(TIn source, Avalonia.Data.BindingMode mode)
Parameters
source TIn
The data source.
mode Avalonia.Data.BindingMode
The binding mode.
Returns
Avalonia.Experimental.Data.Core.TypedBindingExpression<TIn,TOut><TIn, TOut>
Properties
| Name | Description |
|---|---|
| FallbackValue | Gets or sets the value to use when the binding is unable to produce a value. |
| Links | Gets or sets the links in the binding chain. |
| Mode | Gets or sets the binding mode. |
| Priority | Gets or sets the binding priority. |
| Read | Gets or sets the read function. |
| Source | Gets or sets the source for the binding. |
| Write | Gets or sets the write function. |
FallbackValue Property
Gets or sets the value to use when the binding is unable to produce a value.
public Avalonia.Data.Optional<TOut> FallbackValue { get; set; }
Links Property
Gets or sets the links in the binding chain.
public Func<TIn, object>[] Links { get; set; }
Mode Property
Gets or sets the binding mode.
public Avalonia.Data.BindingMode Mode { get; set; }
Priority Property
Gets or sets the binding priority.
public Avalonia.Data.BindingPriority Priority { get; set; }
Read Property
Gets or sets the read function.
public Func<TIn, TOut> Read { get; set; }
Source Property
Gets or sets the source for the binding.
public Avalonia.Data.Optional<TIn> Source { get; set; }
Remarks
If unset the source is the target control's Avalonia.StyledElement.DataContext property.
Write Property
Gets or sets the write function.
public Action<TIn, TOut> Write { get; set; }