Information Technology Reference
In-Depth Information
Yo u r c l a s s n o w w o r k s w i t h t h e e n v e l o p e c l a s s t o h a n d l e i t s i n t e r n a l d a t a .
private
Envelope
data;
public
IBindingList
MyCollection
{
get
{
return
data;
}
}
public void
UpdateData()
{
data.SafeUpdate(UnreliableOperation());
}
The Envelope class implements the IBindingList by forwarding every
request to the contained BindingList<PayrollData>:
public class
Envelope
:
IBindingList
{
private
BindingList
<
PayrollData
> data =
new
BindingList
<
PayrollData
>();
#region
IBindingList Members
public void
AddIndex(
PropertyDescriptor
property)
{ (data
as
IBindingList
).AddIndex(property); }
public object
AddNew() {
return
data.AddNew(); }
public bool
AllowEdit {
get
{
return
data.AllowEdit; } }
public bool
AllowNew {
get
{
return
data.AllowNew; } }
public bool
AllowRemove
{
get
{
return
data.AllowRemove; } }
public void
ApplySort(
PropertyDescriptor
property,
ListSortDirection
direction)
{ (data
as
IBindingList
).
ApplySort(property, direction); }