BindableAttribute 建構函式

定義

BindableAttribute 類別的新執行個體初始化。Initializes a new instance of the BindableAttribute class.

多載

BindableAttribute(Boolean)

初始化 BindableAttribute 類別的新執行個體,其具有布林值。Initializes a new instance of the BindableAttribute class with a Boolean value.

BindableAttribute(BindableSupport)

使用其中一個 BindableSupport值,初始化 BindableAttribute 類別的新執行個體。Initializes a new instance of the BindableAttribute class with one of the BindableSupport values.

BindableAttribute(Boolean, BindingDirection)

BindableAttribute 類別的新執行個體初始化。Initializes a new instance of the BindableAttribute class.

BindableAttribute(BindableSupport, BindingDirection)

BindableAttribute 類別的新執行個體初始化。Initializes a new instance of the BindableAttribute class.

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

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的屬性,會 No值。For a property marked with the BindableAttribute set to false, the value is No. 因此,若要在您的程式碼中檢查這個屬性的值,您必須將屬性指定為 BindableAttribute.YesBindableAttribute.NoTherefore, to check the value of this attribute in your code, you must specify the attribute as BindableAttribute.Yes or BindableAttribute.No.

另請參閱

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)

參數

flags
BindableSupport

其中一個 BindableSupport 值。One of the BindableSupport values.

範例

下列程式碼範例會適當地標示屬性,以將資料系結至。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的屬性,會 No值。For a property marked with the BindableAttribute set to false, the value is No. 因此,若要在您的程式碼中檢查這個屬性的值,您必須將屬性指定為 BindableAttribute.YesBindableAttribute.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 類別的新執行個體初始化。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

true 表示使用繫結屬性,否則為 falsetrue to use property for binding; otherwise, false.

direction
BindingDirection

其中一個 BindingDirection 值。One of the BindingDirection values.

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)

參數

flags
BindableSupport

其中一個 BindableSupport 值。One of the BindableSupport values.

direction
BindingDirection

其中一個 BindingDirection 值。One of the BindingDirection values.

適用於