BindablePropertyKey 类

定义

BindableProperty 的密钥,用于通过受限制的写入访问权限实现 BindableProperty。

public ref class BindablePropertyKey sealed
public sealed class BindablePropertyKey
type BindablePropertyKey = class
Public NotInheritable Class BindablePropertyKey
继承
BindablePropertyKey

注解

下面的示例演示如何创建 BindablePropertyKey。 写入访问权限是在 internal 读取访问时 public

class Bindable : BindableObject
{
  internal static readonly BindablePropertyKey FooPropertyKey = 
    BindableProperty.CreateReadOnly<Bindable, string> (w => w.Foo, default(string));

  public static readonly BindableProperty FooProperty = FooPropertyKey.BindableProperty;

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

属性

BindableProperty

获取 BindableProperty。

适用于