Xamarin.Forms.BindableObjectExtensions.SetBinding Method
Creates and applies a binding to a property.

Syntax

public static void SetBinding (this BindableObject self, BindableProperty targetProperty, string path)

Parameters

self
The Xamarin.Forms.BindableObject.
targetProperty
The BindableProperty on which to set a bindinge.
path
A string indicating the property path to bind to.

Remarks

The following example shows how to use the extension method to set a binding.

C# Example

var label = new Label ();
label.SetBinding (Label.TextProperty, "Name");
label.BindingContext = new {Name = "John Doe", Company = "Xamarin"};
Debug.WriteLine (label.Text); //prints "John Doe"
        

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0