Good morning,
I am facing what appears to be a binding issue with the Infragistics UltraWinGrid (Windows Forms). I have the grid bound to a RoleCollection, an Editable Root List. In the list are Role objects, Editable Child objects. Each Role object has an Editable Child list containing RoleRight objects. The list is lazy-loaded when the Role is expanded.
The error occurs when I delete a RoleRight and then undo the changes, i.e. CancelEdit on the entire RoleCollection. When the changes are cancelled, the object is restored, but the grid contains one less row than it should, though the binding is correct in that the deleted RoleRight object is shown if it wasn't the last item in the list.
So if I have 3 RoleRight objects in the list and delete the middle one, I now have 2 rows in the band showing the first and third RoleRight objects. If I undo, I have 3 RoleRight objects, but I only see two rows in the band showing the first and second RoleRight objects.
I am hoping someone has seen this type of error before as I cannot see any reason why the grid is not displaying the correct number of rows.
Christian
After some investigation, I have some more clues but no answers.
Suppose I have the following RoleRights:
If I delete CanWriteNote (2), then the grid displays, as expected:
If I undo, then the grid displays, incorrectly:
The third item, CanDeleteNote is in the collection, but it is not displayed in the grid.
The other behavior that I observed is that if I add a new item to the collection and then undo it, and then delete the 2nd item and undo, I get the correct results. Why does adding a new item and undoing it cause the list to bind to the grid correctly?
Any thoughts or ideas are highly appreciated.
Christian
Problem solved.
I had a "BindingSource.EndEdit()" in the Delete button handler. Once it was removed, the form functioned as expected.
The next question: Why does EndEdit prevent the undo in the UltraWinGrid?
Christian
I see.
The only thing that bothers me is that the deleted item was returned to the collection, so in that sense, the undo was correct. Only 2 of the 3 items were displayed, so it seems to point to a problem in some part of the binding process.
I will come back to it when time permits. Thanks for the response.
Christian
Thanks again. That sounds like the issue. I'll post here when I get to the bottom of it. Hopefully it will save others the trouble.
Christian
Copyright (c) Marimer LLC