Implementing Rowstate in Custom IBindingList Object

  • Thread starter Thread starter Cary Linkfield
  • Start date Start date
C

Cary Linkfield

I have created a custom class inheriting CollectionBase and implementing
IBindingList. I am binding the list to a datagrid. I would like to have a
property on the class that works like the RowState of a DataRow that can
tell the datagrid not to display the item anymore after it is marked for
deletion by the user. I have a property on the class that indicates whether
the item is Added, Unchanged, Modified or Deleted.

I would like to keep the "deleted" item in the list of objects so I can
correctly process it when the user decides to save changes.
 
Cary Linkfield said:
I have created a custom class inheriting CollectionBase and implementing
IBindingList. I am binding the list to a datagrid. I would like to have
a
property on the class that works like the RowState of a DataRow that can
tell the datagrid not to display the item anymore after it is marked for
deletion by the user. I have a property on the class that indicates
whether
the item is Added, Unchanged, Modified or Deleted.

I would like to keep the "deleted" item in the list of objects so I can
correctly process it when the user decides to save changes.

I don't believe that RowState is what tells the grid what to display. The
grid is displaying a DataView, and the DataView has decided not to display
Deleted rows...

John Saunders
 
That did not answer my question. If the Dataview is what goes between the
IBindingList and the Datagrid, then how do I create a Dataview for my list?

The general question: Is there any way to leave items in the IBindingList
marked as deleted and have the Datagrid not display them?
 
Cary Linkfield said:
That did not answer my question. If the Dataview is what goes between the
IBindingList and the Datagrid, then how do I create a Dataview for my
list?

The general question: Is there any way to leave items in the IBindingList
marked as deleted and have the Datagrid not display them?

The answer is "no".

You should do the same thing as I suggested - bind the DataGrid to an
intermediate object - not directly to your IBindingList. The intermediate
object is the one which would decide not to display some of your list items,
based on your equivalent to RowState.

John Saunders
 
Back
Top