Xamarin.Forms.BindableProperty Class
A BindableProperty is a backing store for properties allowing bindings on Xamarin.Forms.BindableObject.

See Also: BindableProperty Members

Syntax

[System.Diagnostics.DebuggerDisplay("{PropertyName}")]
[Xamarin.Forms.TypeConverter(typeof(Xamarin.Forms.BindablePropertyConverter))]
public sealed class BindableProperty

Remarks

The following example shows the creation of a BindableProperty as a backing store for a property. It shows also how to bind to that BindableProperty.

C# Example

public class MockBindable : BindableObject
{
  public static readonly BindableProperty FooProperty = 
    BindableProperty.Create<MockBindable, string> (w => w.Foo, default(string));

  public string Foo {
    get { return (string)GetValue (FooProperty); }
    set { SetValue (FooProperty, value); } 
  }
}

public class MockViewModel
{
  public string Name {get;set;}
}

MockViewModel model = new MockViewModel { Name = "John Doe" };
var bindable = new MockBindable ();
bindable.SetBinding (MockBindable.FooProperty, "Name");
bindable.BindingContext = model;
Console.WriteLine (bindable.Foo); //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, 1.2.0.0, 1.2.2.0, 1.3.0.0