ControlBindingsCollection ControlBindingsCollection ControlBindingsCollection ControlBindingsCollection Class

定義

コントロールのデータ バインドのコレクションを表します。Represents the collection of data bindings for a control.

public ref class ControlBindingsCollection : System::Windows::Forms::BindingsCollection
[System.ComponentModel.TypeConverter("System.Windows.Forms.Design.ControlBindingsConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.TypeConverter("System.Windows.Forms.Design.ControlBindingsConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.TypeConverter("System.Windows.Forms.Design.ControlBindingsConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class ControlBindingsCollection : System.Windows.Forms.BindingsCollection
type ControlBindingsCollection = class
    inherit BindingsCollection
Public Class ControlBindingsCollection
Inherits BindingsCollection
継承
属性

次のコード例を追加BindingオブジェクトをControlBindingsCollection5 つのコントロール: 4 つTextBoxコントロールとDateTimePickerコントロール。The following code example adds Binding objects to a ControlBindingsCollection of five controls: four TextBox controls and a DateTimePicker control. ControlBindingsCollection には、DataBindings クラスの Control プロパティを使用してアクセスします。The ControlBindingsCollection is accessed through the DataBindings property of the Control class.

protected:
   void BindControls()
   {
      /* Create two Binding objects for the first two TextBox 
         controls. The data-bound property for both controls 
         is the Text property. The data source is a DataSet 
         (ds). The data member is the navigation path: 
         TableName.ColumnName. */
      textBox1->DataBindings->Add( gcnew Binding(
         "Text",ds,"customers.custName" ) );
      textBox2->DataBindings->Add( gcnew Binding(
         "Text",ds,"customers.custID" ) );
      
      /* Bind the DateTimePicker control by adding a new Binding. 
         The data member of the DateTimePicker is a navigation path:
         TableName.RelationName.ColumnName. */
      DateTimePicker1->DataBindings->Add( gcnew Binding(
         "Value",ds,"customers.CustToOrders.OrderDate" ) );
      
      /* Create a new Binding using the DataSet and a 
         navigation path(TableName.RelationName.ColumnName).
         Add event delegates for the Parse and Format events to 
         the Binding object, and add the object to the third 
         TextBox control's BindingsCollection. The delegates 
         must be added before adding the Binding to the 
         collection; otherwise, no formatting occurs until 
         the Current object of the BindingManagerBase for 
         the data source changes. */
      Binding^ b = gcnew Binding(
         "Text",ds,"customers.custToOrders.OrderAmount" );
      b->Parse += gcnew ConvertEventHandler(
         this, &Form1::CurrencyStringToDecimal );
      b->Format += gcnew ConvertEventHandler(
         this, &Form1::DecimalToCurrencyString );
      textBox3->DataBindings->Add( b );
      
      /*Bind the fourth TextBox to the Value of the 
         DateTimePicker control. This demonstates how one control
         can be data-bound to another.*/
      textBox4->DataBindings->Add( "Text", DateTimePicker1, "Value" );
      
      // Get the BindingManagerBase for the textBox4 Binding.
      BindingManagerBase^ bmText = this->BindingContext[
         DateTimePicker1 ];
      
      /* Print the Type of the BindingManagerBase, which is 
         a PropertyManager because the data source
         returns only a single property value. */
      Console::WriteLine( bmText->GetType() );
      
      // Print the count of managed objects, which is one.
      Console::WriteLine( bmText->Count );
      
      // Get the BindingManagerBase for the Customers table. 
      bmCustomers = this->BindingContext[ds, "Customers"];
      
      /* Print the Type and count of the BindingManagerBase.
         Because the data source inherits from IBindingList,
         it is a RelatedCurrencyManager (a derived class of
         CurrencyManager). */
      Console::WriteLine( bmCustomers->GetType() );
      Console::WriteLine( bmCustomers->Count );
      
      /* Get the BindingManagerBase for the Orders of the current
         customer using a navigation path: TableName.RelationName. */
      bmOrders = this->BindingContext[ds, "customers.CustToOrders"];
   }
protected void BindControls()
{
   /* Create two Binding objects for the first two TextBox 
   controls. The data-bound property for both controls 
   is the Text property. The data source is a DataSet 
   (ds). The data member is the navigation path: 
   TableName.ColumnName. */
   textBox1.DataBindings.Add(new Binding
   ("Text", ds, "customers.custName"));
   textBox2.DataBindings.Add(new Binding
   ("Text", ds, "customers.custID"));
      
   /* Bind the DateTimePicker control by adding a new Binding. 
   The data member of the DateTimePicker is a navigation path:
   TableName.RelationName.ColumnName. */
   DateTimePicker1.DataBindings.Add(new 
   Binding("Value", ds, "customers.CustToOrders.OrderDate"));

   /* Create a new Binding using the DataSet and a 
   navigation path(TableName.RelationName.ColumnName).
   Add event delegates for the Parse and Format events to 
   the Binding object, and add the object to the third 
   TextBox control's BindingsCollection. The delegates 
   must be added before adding the Binding to the 
   collection; otherwise, no formatting occurs until 
   the Current object of the BindingManagerBase for 
   the data source changes. */
   Binding b = new Binding
   ("Text", ds, "customers.custToOrders.OrderAmount");
   b.Parse+=new ConvertEventHandler(CurrencyStringToDecimal);
   b.Format+=new ConvertEventHandler(DecimalToCurrencyString);
   textBox3.DataBindings.Add(b);

   /*Bind the fourth TextBox to the Value of the 
   DateTimePicker control. This demonstates how one control
   can be data-bound to another.*/
   textBox4.DataBindings.Add("Text", DateTimePicker1,"Value");

   // Get the BindingManagerBase for the textBox4 Binding.
   BindingManagerBase bmText = this.BindingContext
   [DateTimePicker1];

   /* Print the Type of the BindingManagerBase, which is 
   a PropertyManager because the data source
   returns only a single property value. */
   Console.WriteLine(bmText.GetType().ToString());

   // Print the count of managed objects, which is one.
   Console.WriteLine(bmText.Count);

   // Get the BindingManagerBase for the Customers table. 
   bmCustomers = this.BindingContext [ds, "Customers"];

   /* Print the Type and count of the BindingManagerBase.
   Because the data source inherits from IBindingList,
   it is a RelatedCurrencyManager (a derived class of
   CurrencyManager). */
   Console.WriteLine(bmCustomers.GetType().ToString());
   Console.WriteLine(bmCustomers.Count);
   
   /* Get the BindingManagerBase for the Orders of the current
   customer using a navigation path: TableName.RelationName. */ 
   bmOrders = this.BindingContext[ds, "customers.CustToOrders"];
}
Protected Sub BindControls()
    ' Create two Binding objects for the first two TextBox 
    ' controls. The data-bound property for both controls 
    ' is the Text property. The data source is a DataSet 
    ' (ds). The data member is the navigation path: 
    ' TableName.ColumnName. 
    textBox1.DataBindings.Add _
       (New Binding("Text", ds, "customers.custName"))
    textBox2.DataBindings.Add _
       (New Binding("Text", ds, "customers.custID"))
    
    ' Bind the DateTimePicker control by adding a new Binding. 
    ' The data member of the DateTimePicker is a navigation path:
    ' TableName.RelationName.ColumnName. 
    DateTimePicker1.DataBindings.Add _
       (New Binding("Value", ds, "customers.CustToOrders.OrderDate"))
    
    ' Create a new Binding using the DataSet and a 
    ' navigation path(TableName.RelationName.ColumnName).
    ' Add event delegates for the Parse and Format events to 
    ' the Binding object, and add the object to the third 
    ' TextBox control's BindingsCollection. The delegates 
    ' must be added before adding the Binding to the 
    ' collection; otherwise, no formatting occurs until 
    ' the Current object of the BindingManagerBase for 
    ' the data source changes. 
    Dim b As New Binding("Text", ds, "customers.custToOrders.OrderAmount")
    AddHandler b.Parse, AddressOf CurrencyStringToDecimal
    AddHandler b.Format, AddressOf DecimalToCurrencyString
    textBox3.DataBindings.Add(b)
    
    ' Bind the fourth TextBox to the Value of the 
    ' DateTimePicker control. This demonstates how one control
    ' can be data-bound to another.
    textBox4.DataBindings.Add("Text", DateTimePicker1, "Value")
    
    ' Get the BindingManagerBase for the textBox4 Binding.
    Dim bmText As BindingManagerBase = Me.BindingContext(DateTimePicker1)
    
    ' Print the Type of the BindingManagerBase, which is 
    ' a PropertyManager because the data source
    ' returns only a single property value. 
    Console.WriteLine(bmText.GetType().ToString())
    
    ' Print the count of managed objects, which is one.
    Console.WriteLine(bmText.Count)
    
    ' Get the BindingManagerBase for the Customers table. 
    bmCustomers = Me.BindingContext(ds, "Customers")
    
    ' Print the Type and count of the BindingManagerBase.
    ' Because the data source inherits from IBindingList,
    ' it is a RelatedCurrencyManager (a derived class of
    ' CurrencyManager). 
    Console.WriteLine(bmCustomers.GetType().ToString())
    Console.WriteLine(bmCustomers.Count)
    
    ' Get the BindingManagerBase for the Orders of the current
    ' customer using a navigation path: TableName.RelationName. 
    bmOrders = Me.BindingContext(ds, "customers.CustToOrders")
End Sub    

注釈

単純なデータ バインディングを追加することで実現BindingオブジェクトをControlBindingsCollectionします。Simple data binding is accomplished by adding Binding objects to a ControlBindingsCollection. 継承する任意のオブジェクト、Controlクラスがアクセスできる、ControlBindingsCollectionを通じて、DataBindingsプロパティ。Any object that inherits from the Control class can access the ControlBindingsCollection through the DataBindings property. Windows の一覧は、データ バインディングをサポートするをコントロールにを参照してください、Bindingクラス。For a list of Windows controls that support data binding, see the Binding class.

ControlBindingsCollectionなどの標準的な収集方法を含むAddClear、およびRemoveします。The ControlBindingsCollection contains standard collection methods such as Add, Clear, and Remove.

コントロールを取得、ControlBindingsCollectionを使用するが属している、Controlプロパティ。To get the control that the ControlBindingsCollection belongs to, use the Control property.

コンストラクター

ControlBindingsCollection(IBindableComponent) ControlBindingsCollection(IBindableComponent) ControlBindingsCollection(IBindableComponent) ControlBindingsCollection(IBindableComponent)

指定したバインドできるコントロールを使用して ControlBindingsCollection クラスの新しいインスタンスを初期化します。Initializes a new instance of the ControlBindingsCollection class with the specified bindable control.

プロパティ

BindableComponent BindableComponent BindableComponent BindableComponent

バインディング コレクションが属する IBindableComponent を取得します。Gets the IBindableComponent the binding collection belongs to.

Control Control Control Control

コレクションが属するコントロールを取得します。Gets the control that the collection belongs to.

Count Count Count Count

コレクション内のバインディングの合計数を取得します。Gets the total number of bindings in the collection.

(Inherited from BindingsCollection)
DefaultDataSourceUpdateMode DefaultDataSourceUpdateMode DefaultDataSourceUpdateMode DefaultDataSourceUpdateMode

コレクションに含まれる Binding の既定の DataSourceUpdateMode を取得または設定します。Gets or sets the default DataSourceUpdateMode for a Binding in the collection.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

コレクションが読み取り専用かどうかを示す値を取得します。Gets a value indicating whether the collection is read-only.

(Inherited from BaseCollection)
IsSynchronized IsSynchronized IsSynchronized IsSynchronized

ICollection へのアクセスの同期がとられているかどうかを示す値を取得します。Gets a value indicating whether access to the ICollection is synchronized.

(Inherited from BaseCollection)
Item[Int32] Item[Int32] Item[Int32] Item[Int32]

指定されたインデックス位置にある Binding を取得します。Gets the Binding at the specified index.

(Inherited from BindingsCollection)
Item[String] Item[String] Item[String] Item[String]

コントロールのプロパティ名で指定した Binding を取得します。Gets the Binding specified by the control's property name.

List List List List

コレクション内のバインディングをオブジェクトとして取得します。Gets the bindings in the collection as an object.

(Inherited from BindingsCollection)
SyncRoot SyncRoot SyncRoot SyncRoot

BaseCollection へのアクセスを同期するために使用できるオブジェクトを取得します。Gets an object that can be used to synchronize access to the BaseCollection.

(Inherited from BaseCollection)

メソッド

Add(Binding) Add(Binding) Add(Binding) Add(Binding)

指定された Binding をコレクションに追加します。Adds the specified Binding to the collection.

Add(String, Object, String) Add(String, Object, String) Add(String, Object, String) Add(String, Object, String)

指定したコントロール プロパティ名、データ ソース、およびデータ メンバーを使用して Binding を作成し、コレクションに追加します。Creates a Binding using the specified control property name, data source, and data member, and adds it to the collection.

Add(String, Object, String, Boolean) Add(String, Object, String, Boolean) Add(String, Object, String, Boolean) Add(String, Object, String, Boolean)

指定したコントロール プロパティ名、データ ソース、データ メンバー、および書式指定を有効にするかどうかに関する情報を使用してバインディングを作成し、コレクションに追加します。Creates a binding with the specified control property name, data source, data member, and information about whether formatting is enabled, and adds the binding to the collection.

Add(String, Object, String, Boolean, DataSourceUpdateMode) Add(String, Object, String, Boolean, DataSourceUpdateMode) Add(String, Object, String, Boolean, DataSourceUpdateMode) Add(String, Object, String, Boolean, DataSourceUpdateMode)

指定したコントロール プロパティを、指定したデータ ソースの指定したデータ メンバーにバインドするバインディングを作成します。さらに、オプションで書式指定を有効にし、指定した更新設定に基づいてデータ ソースに値を反映し、バインディングをコレクションに追加します。Creates a binding that binds the specified control property to the specified data member of the specified data source, optionally enabling formatting, propagating values to the data source based on the specified update setting, and adding the binding to the collection.

Add(String, Object, String, Boolean, DataSourceUpdateMode, Object) Add(String, Object, String, Boolean, DataSourceUpdateMode, Object) Add(String, Object, String, Boolean, DataSourceUpdateMode, Object) Add(String, Object, String, Boolean, DataSourceUpdateMode, Object)

指定したコントロール プロパティを、指定したデータ ソースの指定したデータ メンバーにバインドするバインディングを作成します。さらに、オプションで書式指定を有効にし、指定した更新設定に基づいてデータ ソースに値を反映し、データ ソースから DBNull が返されたときにプロパティに指定した値を設定し、バインディングをコレクションに追加します。Creates a binding that binds the specified control property to the specified data member of the specified data source, optionally enabling formatting, propagating values to the data source based on the specified update setting, setting the property to the specified value when DBNull is returned from the data source, and adding the binding to the collection.

Add(String, Object, String, Boolean, DataSourceUpdateMode, Object, String) Add(String, Object, String, Boolean, DataSourceUpdateMode, Object, String) Add(String, Object, String, Boolean, DataSourceUpdateMode, Object, String) Add(String, Object, String, Boolean, DataSourceUpdateMode, Object, String)

指定したコントロール プロパティを、指定したデータ ソースの指定したデータ メンバーにバインドするバインディングを作成します。さらに、オプションで指定した書式指定文字列を使用して書式指定を有効にし、指定した更新設定に基づいてデータ ソースに値を反映し、データ ソースから DBNull が返されたときにプロパティに指定した値を設定し、バインディングをコレクションに追加します。Creates a binding that binds the specified control property to the specified data member of the specified data source, optionally enabling formatting with the specified format string, propagating values to the data source based on the specified update setting, setting the property to the specified value when DBNull is returned from the data source, and adding the binding to the collection.

Add(String, Object, String, Boolean, DataSourceUpdateMode, Object, String, IFormatProvider) Add(String, Object, String, Boolean, DataSourceUpdateMode, Object, String, IFormatProvider) Add(String, Object, String, Boolean, DataSourceUpdateMode, Object, String, IFormatProvider) Add(String, Object, String, Boolean, DataSourceUpdateMode, Object, String, IFormatProvider)

指定したコントロール プロパティを、指定したデータ ソースの指定したデータ メンバーにバインドするバインディングを作成します。さらに、オプションで指定した書式指定文字列を使用して書式指定を有効にし、指定した更新設定に基づいてデータ ソースに値を反映し、データ ソースから DBNull が返されたときにプロパティに指定した値を設定し、指定した書式プロバイダーを設定し、バインディングをコレクションに追加します。Creates a binding that binds the specified control property to the specified data member of the specified data source, optionally enabling formatting with the specified format string, propagating values to the data source based on the specified update setting, setting the property to the specified value when DBNull is returned from the data source, setting the specified format provider, and adding the binding to the collection.

AddCore(Binding) AddCore(Binding) AddCore(Binding) AddCore(Binding)

バインディングをコレクションに追加します。Adds a binding to the collection.

Clear() Clear() Clear() Clear()

バインディングのコレクションを消去します。Clears the collection of any bindings.

ClearCore() ClearCore() ClearCore() ClearCore()

コレクション内のバインディングを消去します。Clears the bindings in the collection.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

現在の 1 次元 Array のすべての要素を、指定した 1 次元 ArrayArray の指定したコピー先インデックスを開始位置としてコピーします。Copies all the elements of the current one-dimensional Array to the specified one-dimensional Array starting at the specified destination Array index.

(Inherited from BaseCollection)
CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

コレクションのメンバーを反復処理できるオブジェクトを取得します。Gets the object that enables iterating through the members of the collection.

(Inherited from BaseCollection)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

このインスタンスの有効期間ポリシーを制御する有効期間サービス オブジェクトを取得します。Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

現在の MarshalByRefObject オブジェクトの簡易コピーを作成します。Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs)

CollectionChanged イベントを発生させます。Raises the CollectionChanged event.

(Inherited from BindingsCollection)
OnCollectionChanging(CollectionChangeEventArgs) OnCollectionChanging(CollectionChangeEventArgs) OnCollectionChanging(CollectionChangeEventArgs) OnCollectionChanging(CollectionChangeEventArgs)

CollectionChanging イベントを発生させます。Raises the CollectionChanging event.

(Inherited from BindingsCollection)
Remove(Binding) Remove(Binding) Remove(Binding) Remove(Binding)

指定した Binding をコレクションから削除します。Deletes the specified Binding from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

指定したインデックスの Binding を削除します。Deletes the Binding at the specified index.

RemoveCore(Binding) RemoveCore(Binding) RemoveCore(Binding) RemoveCore(Binding)

指定したバインディングをコレクションから削除します。Removes the specified binding from the collection.

ShouldSerializeMyAll() ShouldSerializeMyAll() ShouldSerializeMyAll() ShouldSerializeMyAll()

コレクションをシリアル化する必要があるかどうかを示す値を取得します。Gets a value that indicates whether the collection should be serialized.

(Inherited from BindingsCollection)
ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

イベント

CollectionChanged CollectionChanged CollectionChanged CollectionChanged

コレクションが変更されたときに発生します。Occurs when the collection has changed.

(Inherited from BindingsCollection)
CollectionChanging CollectionChanging CollectionChanging CollectionChanging

コレクションが変更される直前に発生します。Occurs when the collection is about to change.

(Inherited from BindingsCollection)

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable の要素を、指定した型にキャストします。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

指定された型に基づいて IEnumerable の要素をフィルター処理します。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

クエリの並列化を有効にします。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerableIQueryable に変換します。Converts an IEnumerable to an IQueryable.

適用対象