Xamarin.Forms.BindableObject.BindingContextProperty Field
Implements the bound property whose interface is provided by the BindableObject.BindingContext property.

Syntax

public static readonly BindableProperty BindingContextProperty

Remarks

Note: Typically, the runtime performance is better if BindableObject.BindingContext is set after all calls to BindableObject.SetBinding have been made.

The following example shows how to set a binding to the BindingContext:

C# Example

class PersonView : ContentView 
{
  public PersonView ()
  {
    var label = new Label ();
    label.SetBinding (Label.TextProperty, "Name");
    Content = label;
  }
}

var stack = new StackLayout {
  Orientation = StackOrientation.Vertical,  
};

var jane = new PersonView ();
jane.SetBinding (BindableObject.BindingContext, "Jane");
stack.Children.Add (jane);

var john = new PersonView ();
john.SetBinding (BindableObject.BindingContext, "John");
stack.Children.Add (john);

stack.BindingContext = new {Jane = new {Name = "Jane Doe"}, John = new {Name = "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, 1.2.0.0, 1.3.0.0