BindableAttribute BindableAttribute BindableAttribute BindableAttribute Constructors

定义

重载

BindableAttribute(Boolean) BindableAttribute(Boolean) BindableAttribute(Boolean) BindableAttribute(Boolean)

用布尔值初始化 BindableAttribute 类的新实例。Initializes a new instance of the BindableAttribute class with a Boolean value.

BindableAttribute(BindableSupport) BindableAttribute(BindableSupport) BindableAttribute(BindableSupport) BindableAttribute(BindableSupport)

使用其中一个 BindableSupport 值初始化 BindableAttribute 类的新实例。Initializes a new instance of the BindableAttribute class with one of the BindableSupport values.

BindableAttribute(Boolean, BindingDirection) BindableAttribute(Boolean, BindingDirection) BindableAttribute(Boolean, BindingDirection) BindableAttribute(Boolean, BindingDirection)

初始化 BindableAttribute 类的新实例。Initializes a new instance of the BindableAttribute class.

BindableAttribute(BindableSupport, BindingDirection) BindableAttribute(BindableSupport, BindingDirection) BindableAttribute(BindableSupport, BindingDirection) BindableAttribute(BindableSupport, BindingDirection)

初始化 BindableAttribute 类的新实例。Initializes a new instance of the BindableAttribute class.

BindableAttribute(Boolean) BindableAttribute(Boolean) BindableAttribute(Boolean) BindableAttribute(Boolean)

用布尔值初始化 BindableAttribute 类的新实例。Initializes a new instance of the BindableAttribute class with a Boolean value.

public:
 BindableAttribute(bool bindable);
public BindableAttribute (bool bindable);
new System.ComponentModel.BindableAttribute : bool -> System.ComponentModel.BindableAttribute
Public Sub New (bindable As Boolean)

参数

bindable
Boolean Boolean Boolean Boolean

若要将属性用于绑定,则为 true;否则为 falsetrue to use property for binding; otherwise, false.

示例

下面的代码示例根据适当的方式标记用于将数据绑定到的属性。The following code example marks a property as appropriate to bind data to. 此代码示例将创建一个BindableAttribute新的, 并将BindableAttribute.Yes其值设置为, 并将其绑定到属性。This code example creates a new BindableAttribute, sets its value to BindableAttribute.Yes, and binds it to the property.

public:
   [property:Bindable(true)]
   property int MyProperty 
   {
      int get()
      {
         // Insert code here.
         return 0;
      }
      void set( int theValue )
      {
         // Insert code here.
      }
   }
[Bindable(true)]
 public int MyProperty {
    get {
       // Insert code here.
       return 0;
    }
    set {
       // Insert code here.
    }
 }
   
<Bindable(true)> _
Public Property MyProperty As Integer
   Get
      ' Insert code here.
      Return 0
   End Get
   Set
      ' Insert code here.
   End Set
End Property
  

注解

当您使用BindableAttribute设置为true的将属性标记为时, 此属性的值将设置为常量成员YesWhen you mark a property with the BindableAttribute set to true, the value of this attribute is set to the constant member Yes. 对于标记有设置为BindableAttribute false的的属性, 值为NoFor a property marked with the BindableAttribute set to false, the value is No. 因此, 若要在代码中检查此属性的值, 必须将属性指定为BindableAttribute.Yes或。 BindableAttribute.NoTherefore, to check the value of this attribute in your code, you must specify the attribute as BindableAttribute.Yes or BindableAttribute.No.

另请参阅

BindableAttribute(BindableSupport) BindableAttribute(BindableSupport) BindableAttribute(BindableSupport) BindableAttribute(BindableSupport)

使用其中一个 BindableSupport 值初始化 BindableAttribute 类的新实例。Initializes a new instance of the BindableAttribute class with one of the BindableSupport values.

public:
 BindableAttribute(System::ComponentModel::BindableSupport flags);
public BindableAttribute (System.ComponentModel.BindableSupport flags);
new System.ComponentModel.BindableAttribute : System.ComponentModel.BindableSupport -> System.ComponentModel.BindableAttribute
Public Sub New (flags As BindableSupport)

参数

示例

下面的代码示例根据适当的方式标记用于将数据绑定到的属性。The following code example marks a property as appropriate to bind data to. 此代码示例将创建一个BindableAttribute新的, 并将BindableAttribute.Yes其值设置为, 并将其绑定到属性。This code example creates a new BindableAttribute, sets its value to BindableAttribute.Yes, and binds it to the property.


   [Bindable(BindableSupport::Yes)]
   int get()
   {
      
      // Insert code here.
      return 0;
   }

   void set( int theValue )
   {
      
      // Insert code here.
   }

}
[Bindable(BindableSupport.Yes)]
 public int MyProperty {
    get {
       // Insert code here.
       return 0;
    }
    set {
       // Insert code here.
    }
 }
   
<Bindable(BindableSupport.Yes)> _
Public Property MyProperty As Integer
   Get
      ' Insert code here.
      Return 0
   End Get
   Set
      ' Insert code here.
   End Set
End Property
  

注解

当您使用BindableAttribute设置为true的将属性标记为时, 此属性的值将设置为常量成员YesWhen you mark a property with the BindableAttribute set to true, the value of this attribute is set to the constant member Yes. 对于标记有设置为BindableAttribute false的的属性, 值为NoFor a property marked with the BindableAttribute set to false, the value is No. 因此, 若要在代码中检查此属性的值, 必须将属性指定为BindableAttribute.Yes或。 BindableAttribute.NoTherefore, to check the value of this attribute in your code, you must specify the attribute as BindableAttribute.Yes or BindableAttribute.No.

另请参阅

BindableAttribute(Boolean, BindingDirection) BindableAttribute(Boolean, BindingDirection) BindableAttribute(Boolean, BindingDirection) BindableAttribute(Boolean, BindingDirection)

初始化 BindableAttribute 类的新实例。Initializes a new instance of the BindableAttribute class.

public:
 BindableAttribute(bool bindable, System::ComponentModel::BindingDirection direction);
public BindableAttribute (bool bindable, System.ComponentModel.BindingDirection direction);
new System.ComponentModel.BindableAttribute : bool * System.ComponentModel.BindingDirection -> System.ComponentModel.BindableAttribute
Public Sub New (bindable As Boolean, direction As BindingDirection)

参数

bindable
Boolean Boolean Boolean Boolean

若要将属性用于绑定,则为 true;否则为 falsetrue to use property for binding; otherwise, false.

BindableAttribute(BindableSupport, BindingDirection) BindableAttribute(BindableSupport, BindingDirection) BindableAttribute(BindableSupport, BindingDirection) BindableAttribute(BindableSupport, BindingDirection)

初始化 BindableAttribute 类的新实例。Initializes a new instance of the BindableAttribute class.

public:
 BindableAttribute(System::ComponentModel::BindableSupport flags, System::ComponentModel::BindingDirection direction);
public BindableAttribute (System.ComponentModel.BindableSupport flags, System.ComponentModel.BindingDirection direction);
new System.ComponentModel.BindableAttribute : System.ComponentModel.BindableSupport * System.ComponentModel.BindingDirection -> System.ComponentModel.BindableAttribute
Public Sub New (flags As BindableSupport, direction As BindingDirection)

参数

适用于