BindableAttribute 建構函式

定義

初始化 BindableAttribute 類別的新執行個體。

多載

名稱 Description
BindableAttribute(Boolean)

初始化一個帶有布林值的新 BindableAttribute 類別實例。

BindableAttribute(BindableSupport)

初始化一個新的類別實例 BindableAttribute ,使用其中一個 BindableSupport 值。

BindableAttribute(Boolean, BindingDirection)

初始化 BindableAttribute 類別的新執行個體。

BindableAttribute(BindableSupport, BindingDirection)

初始化 BindableAttribute 類別的新執行個體。

BindableAttribute(Boolean)

初始化一個帶有布林值的新 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。 對於標記為 BindableAttributefalse屬性,值為 No。 因此,要檢查程式碼中該屬性的值,必須指定 BindableAttribute.Yes 為 或 BindableAttribute.No

另請參閱

適用於

BindableAttribute(BindableSupport)

初始化一個新的類別實例 BindableAttribute ,使用其中一個 BindableSupport 值。

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。 對於標記為 BindableAttributefalse屬性,值為 No。 因此,要檢查程式碼中該屬性的值,必須指定 BindableAttribute.Yes 為 或 BindableAttribute.No

另請參閱

適用於

BindableAttribute(Boolean, BindingDirection)

初始化 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)

初始化 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 價值。

適用於