ControlBindingsCollection 클래스

정의

컨트롤에 대한 데이터 바인딩의 컬렉션을 나타냅니다.

public ref class ControlBindingsCollection : System::Windows::Forms::BindingsCollection
[System.ComponentModel.TypeConverter("System.Windows.Forms.Design.ControlBindingsConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class ControlBindingsCollection : System.Windows.Forms.BindingsCollection
[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
[System.ComponentModel.TypeConverter("System.Windows.Forms.Design.ControlBindingsConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class ControlBindingsCollection : System.Windows.Forms.BindingsCollection
[<System.ComponentModel.TypeConverter("System.Windows.Forms.Design.ControlBindingsConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
type ControlBindingsCollection = class
    inherit BindingsCollection
[<System.ComponentModel.TypeConverter("System.Windows.Forms.Design.ControlBindingsConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
type ControlBindingsCollection = class
    inherit BindingsCollection
[<System.ComponentModel.TypeConverter("System.Windows.Forms.Design.ControlBindingsConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
type ControlBindingsCollection = class
    inherit BindingsCollection
Public Class ControlBindingsCollection
Inherits BindingsCollection
상속
특성

예제

다음 코드 예제에서는 개체를 ControlBindingsCollection 5개의 컨트롤인 4개의 TextBox 컨트롤과 컨트롤에 DateTimePicker 추가 Binding 합니다. ControlBindingsCollectionDataBindings 클래스의 Control 속성을 통해 액세스됩니다.

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수행합니다. 클래스에서 상속되는 모든 개체는 Control 속성을 통해 DataBindingsControlBindingsCollection 액세스할 수 있습니다. 데이터 바인딩을 지원하는 Windows 컨트롤 목록은 클래스를 Binding 참조하세요.

에는 , Clear및 와 같은 Add표준 컬렉션 메서드가 포함되어 있습니다Remove.ControlBindingsCollection

에 속하는 컨트롤을 ControlBindingsCollection 얻으려면 속성을 사용합니다 Control .

생성자

ControlBindingsCollection(IBindableComponent)

지정된 바인딩 가능한 컨트롤을 사용하여 ControlBindingsCollection 클래스의 새 인스턴스를 초기화합니다.

속성

BindableComponent

바인딩 컬렉션이 속한 IBindableComponent를 가져옵니다.

Control

컬렉션이 속한 컨트롤을 가져옵니다.

Count

컬렉션의 전체 바인딩 수를 가져옵니다.

(다음에서 상속됨 BindingsCollection)
DefaultDataSourceUpdateMode

컬렉션의 Binding에 대한 기본 DataSourceUpdateMode를 가져오거나 설정합니다.

IsReadOnly

컬렉션이 읽기 전용인지를 나타내는 값을 가져옵니다.

(다음에서 상속됨 BaseCollection)
IsSynchronized

ICollection에 대한 액세스가 동기화되는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 BaseCollection)
Item[Int32]

지정된 인덱스의 Binding를 가져옵니다.

(다음에서 상속됨 BindingsCollection)
Item[String]

컨트롤의 속성 이름으로 지정된 Binding을 가져옵니다.

List

컬렉션의 바인딩을 개체로 가져옵니다.

(다음에서 상속됨 BindingsCollection)
SyncRoot

BaseCollection에 대한 액세스를 동기화하는 데 사용할 수 있는 개체를 가져옵니다.

(다음에서 상속됨 BaseCollection)

메서드

Add(Binding)

지정된 Binding를 컬렉션에 추가합니다.

Add(String, Object, String)

지정된 컨트롤 속성 이름, 데이터 소스 및 데이터 멤버를 사용하여 Binding을 만든 다음 컬렉션에 추가합니다.

Add(String, Object, String, Boolean)

지정된 컨트롤 속성 이름, 데이터 소스, 데이터 멤버, 형식을 지정할 수 있는지 여부에 대한 정보 등을 사용하여 바인딩을 만든 다음 컬렉션에 바인딩을 추가합니다.

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

지정된 컨트롤 속성을 지정된 데이터 소스의 지정된 데이터 멤버에 바인딩하는 바인딩을 만들고, 선택적으로 형식 지정을 활성화하고, 지정된 업데이트 설정을 기반으로 데이터 소스에 값을 전파하고, 바인딩을 컬렉션에 추가합니다.

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

지정된 컨트롤 속성을 지정된 데이터 소스의 지정된 데이터 멤버에 바인딩하는 바인딩을 만들고, 선택적으로 형식 지정을 활성화하고, 지정된 업데이트 설정을 기반으로 데이터 소스에 값을 전파하고, 데이터 소스에서 DBNull이 반환되면 해당 속성을 지정된 값으로 설정하고, 바인딩을 컬렉션에 추가합니다.

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

지정된 컨트롤 속성을 지정된 데이터 소스의 지정된 데이터 멤버에 바인딩하는 바인딩을 만들고, 선택적으로 지정된 형식 문자열을 사용하여 형식 지정을 활성화하고, 지정된 업데이트 설정을 기반으로 데이터 소스에 값을 전파하고, 데이터 소스에서 DBNull이 반환되면 해당 속성을 지정된 값으로 설정하고, 바인딩을 컬렉션에 추가합니다.

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

지정된 컨트롤 속성을 지정된 데이터 소스의 지정된 데이터 멤버에 바인딩하는 바인딩을 만들고, 선택적으로 지정된 형식 문자열을 사용하여 형식 지정을 활성화하고, 지정된 업데이트 설정을 기반으로 데이터 소스에 값을 전파하고, 데이터 소스에서 DBNull이 반환되면 해당 속성을 지정된 값으로 설정하고, 지정된 형식 공급자를 설정하고, 바인딩을 컬렉션에 추가합니다.

AddCore(Binding)

컬렉션에 바인딩을 추가합니다.

Clear()

모든 바인딩의 컬렉션을 지웁니다.

ClearCore()

컬렉션의 바인딩을 지웁니다.

CopyTo(Array, Int32)

현재 1차원 Array의 모든 요소를 지정된 대상 Array 인덱스부터 시작하여 지정된 1차원 Array에 복사합니다.

(다음에서 상속됨 BaseCollection)
CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetEnumerator()

컬렉션의 멤버 전체를 반복하도록 허용하는 개체를 가져옵니다.

(다음에서 상속됨 BaseCollection)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.

(다음에서 상속됨 MarshalByRefObject)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
InitializeLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.

(다음에서 상속됨 MarshalByRefObject)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
OnCollectionChanged(CollectionChangeEventArgs)

CollectionChanged 이벤트를 발생시킵니다.

(다음에서 상속됨 BindingsCollection)
OnCollectionChanging(CollectionChangeEventArgs)

CollectionChanging 이벤트를 발생시킵니다.

(다음에서 상속됨 BindingsCollection)
Remove(Binding)

컬렉션에서 지정된 Binding을 삭제합니다.

RemoveAt(Int32)

지정한 인덱스의 Binding을 삭제합니다.

RemoveCore(Binding)

컬렉션에서 지정된 바인딩을 제거합니다.

ShouldSerializeMyAll()

컬렉션이 serialize되어야 하는지를 나타내는 값을 가져옵니다.

(다음에서 상속됨 BindingsCollection)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

이벤트

CollectionChanged

컬렉션이 변경될 때 발생합니다.

(다음에서 상속됨 BindingsCollection)
CollectionChanging

컬렉션이 변경되려고 할 때 발생합니다.

(다음에서 상속됨 BindingsCollection)

확장 메서드

Cast<TResult>(IEnumerable)

IEnumerable의 요소를 지정된 형식으로 캐스팅합니다.

OfType<TResult>(IEnumerable)

지정된 형식에 따라 IEnumerable의 요소를 필터링합니다.

AsParallel(IEnumerable)

쿼리를 병렬화할 수 있도록 합니다.

AsQueryable(IEnumerable)

IEnumerableIQueryable로 변환합니다.

적용 대상