Xamarin.Forms.BindableObject.GetValue Method
Returns the value that is contained the BindableProperty.

Syntax

public object GetValue (BindableProperty property)

Parameters

property
The BindableProperty for which to get the value.

Returns

The value that is contained the Xamarin.Forms.BindableProperty.

Remarks

BindableObject.GetValue and BindableObject.SetValue are used to access the values of properties that are implemented by a Xamarin.Forms.BindableProperty. That is, application developers typically provide an interface for a bound property by defining public property whose get accessor casts the result of BindableObject.GetValue to the appropriate type and returns it, and whose get accessor uses BindableObject.SetValue to set the value on the correct property. Application developers should perform no other steps in the public property that defines the interface of the bound property.

The following example shows how to create a bindable property interface for an implementation that will be provided in the target property when the binding is made at run time.

C# Example

class MyBindable : BindableObject
{
  public static readonly BindableProperty MyProperty = 
    BindableProperty.Create<MyBindable, string> (w => w.My, default(string));

  public string My {
    get { return (string)GetValue (MyProperty); }
    set { SetValue (MyProperty, value); } 
  }
}
        

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