My problem is very simple, I am removing a row from a win grid and the After rows removed event won't fire. Conversely, the rows added event does not fire when adding rows.
I'm not adding the rows manually. The rows are being removed implicitly from a backend call, therefore I can't post the code. The only code I have is a backend call.
The grid events only fire if the user removes or adds a row through the grid UI.
If you remove (or add) a row in code from your data source in code, then the data source sends a notification to the grid (and other bound controls) that this happened. The grid, in this case, is a consumer of the event, not the originator.
If you are modifying the data source in code, you really don't need an event to tell you that this happened, since you already know. But if you want to use an event, you may be able to hook an event on your datasource - or through the IBindingList interface, which is what the grid uses.
Thanks for the response.
The Data Grid View by Microsoft has a RowsAdded and a RowsRemoved event that are very useful. Without getting into the details (because it's complicated to explain) in this instance it would be much easier for an event to fire like the DGV.
However, if there is no such event then I guess that's that. I am kind of NOOB so I don't really know what this IBindingList is so I will look into that.
Cheers!
Hi,
You are not the first person to ask for events like these, and I can see how it would be useful. Unfortunately, we cannot use the grid's existing events without breaking existing behavior. So what we would have to do is add some new events for these cases - or maybe one new event with event args that give you a context of what happened.
It's not always easy to tell, though. The BindingManager and IBindingList aren't always intuitive and sometime the grid has to simply mark a particular collection of rows as dirty and just re-synchronize the whole collection the next time it paints, because it just cannot tell exactly what changed. The grid sometimes does this asynchronously, as well. So it's a very tricky thing to handle.
Anyway, I encourage you to Submit a feature request to Infragistics