Share via


BindableAttribute 构造函数

定义

初始化 BindableAttribute 类的新实例。

重载

BindableAttribute(Boolean)

用布尔值初始化 BindableAttribute 类的新实例。

BindableAttribute(BindableSupport)

使用其中一个 BindableSupport 值初始化 BindableAttribute 类的新实例。

BindableAttribute(Boolean, BindingDirection)

初始化 BindableAttribute 类的新实例。

BindableAttribute(BindableSupport, BindingDirection)

初始化 BindableAttribute 类的新实例。

BindableAttribute(Boolean)

Source:
BindableAttribute.cs
Source:
BindableAttribute.cs
Source:
BindableAttribute.cs

用布尔值初始化 BindableAttribute 类的新实例。

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

参数

bindable
Boolean

若要将属性用于绑定,则为 true;否则为 false

示例

下面的代码示例将属性标记为适合将数据绑定到。 此代码示例创建一个新的 BindableAttribute,将其值设置为 BindableAttribute.Yes,并将其绑定到 属性。

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

注解

将 属性BindableAttributetrue标记为 时,此属性的值设置为常量成员 Yes。 对于标记为 BindableAttribute 设置为 false的属性,值为 No。 因此,若要在代码中检查此属性的值,必须将 特性指定为 BindableAttribute.YesBindableAttribute.No

另请参阅

适用于

BindableAttribute(BindableSupport)

Source:
BindableAttribute.cs
Source:
BindableAttribute.cs
Source:
BindableAttribute.cs

使用其中一个 BindableSupport 值初始化 BindableAttribute 类的新实例。

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)

参数

flags
BindableSupport

BindableSupport 值之一。

示例

下面的代码示例将属性标记为适合将数据绑定到。 此代码示例创建一个新的 BindableAttribute,将其值设置为 BindableAttribute.Yes,并将其绑定到 属性。


   [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

注解

将 属性BindableAttributetrue标记为 时,此属性的值设置为常量成员 Yes。 对于标记为 BindableAttribute 设置为 false的属性,值为 No。 因此,若要在代码中检查此属性的值,必须将 特性指定为 BindableAttribute.YesBindableAttribute.No

另请参阅

适用于

BindableAttribute(Boolean, BindingDirection)

Source:
BindableAttribute.cs
Source:
BindableAttribute.cs
Source:
BindableAttribute.cs

初始化 BindableAttribute 类的新实例。

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

若要将属性用于绑定,则为 true;否则为 false

direction
BindingDirection

BindingDirection 值之一。

适用于

BindableAttribute(BindableSupport, BindingDirection)

Source:
BindableAttribute.cs
Source:
BindableAttribute.cs
Source:
BindableAttribute.cs

初始化 BindableAttribute 类的新实例。

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)

参数

flags
BindableSupport

BindableSupport 值之一。

direction
BindingDirection

BindingDirection 值之一。

适用于