2 // System.Windows.Forms.BindingsCollection.cs
5 // stubbed out by Jaak Simm (jaaksimm@firm.ee)
6 // Dennis Hayes (dennish@Raytek.com)
8 // (C) 2002/3 Ximian, Inc
11 using System
.Collections
;
12 using System
.ComponentModel
;
14 namespace System
.Windows
.Forms
{
17 /// Represents a collection of Binding objects for a control.
21 public class BindingsCollection
: BaseCollection
{
24 protected internal BindingsCollection ()
29 // --- public and protected Properties ---
30 public override int Count
{
36 public Binding
this[int index
] {
38 return (Binding
)(base.List
[index
]);
43 protected override ArrayList List
{
49 // --- public Methods ---
50 // following internal methods are (will) not be stubbed out:
52 protected virtual void AddCore(Binding dataBinding
) {
56 protected virtual void ClearCore(){
60 protected virtual void RemoveCore(Binding dataBinding
){
64 // CollectionChanged event:
65 // Though it was not documented, here methods Add and Remove
66 // cause the CollectionChanged event to occur, similarily as Clear.
67 // Would be nice if someone checked the exact event behavior of .NET implementation.
69 protected internal void Add(Binding binding
)
71 base.List
.Add(binding
);
72 OnCollectionChanged(new CollectionChangeEventArgs(
73 CollectionChangeAction
.Add
,
78 protected internal void Clear()
81 OnCollectionChanged(new CollectionChangeEventArgs(
82 CollectionChangeAction
.Refresh
,
87 protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent
)
89 if (CollectionChanged
!= null)
90 CollectionChanged(this, ccevent
);
93 protected internal void Remove(Binding binding
)
95 base.List
.Remove(binding
);
96 OnCollectionChanged(new CollectionChangeEventArgs(
97 CollectionChangeAction
.Remove
,
102 protected internal void RemoveAt(int index
)
104 base.List
.RemoveAt(index
);
105 OnCollectionChanged(new CollectionChangeEventArgs(
106 CollectionChangeAction
.Remove
,
111 protected internal bool ShouldSerializeMyAll()
113 if (this.Count
>0) return true;
118 public event CollectionChangeEventHandler CollectionChanged
;