Xamarin.Forms.BindableObject.SetValue Method
Sets the value of the propertyKey.

Syntax

public void SetValue (BindablePropertyKey propertyKey, object value)

Parameters

propertyKey
The BindablePropertyKey on which to assign a value.
value
The value to set.

Remarks

This method and Xamarin.Forms.BindablePropertyKey are useful to implement BindableProperties with limited write access. The write access is limited to the scope of the BindablePropertyKey.

The following example shows how to declare a BindableProperty with "internal" write access.

C# Example

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

  public string My {
    get { return (string)GetValue (MyProperty); }
    internal set { SetValue (MyPropertyKey, 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