I'm using the GGC with a custom class as datasource. My custom class is a generic list that inherits from CollectionBase and implements the IBindingList interface. The elements of the list are also custom classes that implement the IEditableObject interface.
My implementation works fine in general terms. I'm able to display data on the grid properly and according to the format I need. Also, changes made to cell values are reflected back to the database via my class without any issues. The only issue I'm having is regarding the AddNewRow which is behaving in a funny way.
When I enter a value on any of the AddNewRow cells, a new item is added to the datasource (via AddNew method calling) and default values for all the fields are properly populated. I'm able to fill all cell values and when I either press enter or change to another cell the new row is "accepted" and a blank AddNewRow added to the grid. However, if rather than keep on entering values on row I change to another cell immediately after entering the first value I get the following error message on a pop-up window: "AddNew not called", which is launched by the GGC itself.
I spent some time debugging it and I noticed the following:
1) When I complete more than one cell value for the AddNewRow and then change to another cell, the Action property of CurrentRecordContextChangeEventArgs is set to EndEditCalled and then the EndEdit() method of my class is called.
2) When I complete just ONE cell value for the AddNewRow and then change to another cell, the Action property of CurrentRecordContextChangeEventArgs is set to EndEditCalled and then the CancelEdit() (!!!!) method of my class is called.
I would like to understand why is this happening (it looks like a bug to me) and what steps should I follow to overcome it. Please find attached my classes in case my implementation of the either the IBindingList or IEditableObject were the cause of the problem.
Please let me know if you need further information.
I look forward to your advice.
Regards,
Marcelo
classes.zip