Class Binding
A XAML binding.
public class Binding : BindingBase, IBinding
- Inheritance
-
Binding
- Implements
- Inherited Members
Constructors
Binding()
Initializes a new instance of the Binding class.
public Binding()
Binding(string, BindingMode)
Initializes a new instance of the Binding class.
public Binding(string path, BindingMode mode = BindingMode.Default)
Parameters
path
stringThe binding path.
mode
BindingModeThe binding mode.
Properties
ElementName
Gets or sets the name of the element to use as the binding source.
public string? ElementName { get; set; }
Property Value
Path
Gets or sets the binding path.
public string Path { get; set; }
Property Value
RelativeSource
Gets or sets the relative source for the binding.
public RelativeSource? RelativeSource { get; set; }
Property Value
Source
Gets or sets the source for the binding.
public object? Source { get; set; }
Property Value
TypeResolver
Gets or sets a function used to resolve types from names in the binding path.
public Func<string?, string, Type>? TypeResolver { get; set; }
Property Value
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 override InstancedBinding? Initiate(AvaloniaObject target, AvaloniaProperty? targetProperty, object? anchor = null, bool enableDataValidation = false)
Parameters
target
AvaloniaObjectThe target instance.
targetProperty
AvaloniaPropertyThe target property. May be null.
anchor
objectAn 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
boolWhether data validation should be enabled.
Returns
- InstancedBinding
A InstancedBinding or null if the binding could not be resolved.