hello,
I'm looking for a good event that tells me when a new row was added via the data source or a row has been removed from the data source.Something like that already works with the event "InitializeRow". However, this does not work for deleted rows.I do not know the type of data source, and therefore looking for a event at the ultra grid, to be informed regardless of the type of data source.
There are two events "AfterRowInsert" and "AfterRowsDeleted" that unfortunately not fire when the row was added or deleted by code.
You could try PropertyChanged. But you have to be careful, because this event fires a lot - so it's important that your code be as efficient as possible. In fact, I would advise against check the grid.Rows.Count inside this event, since this might have unintended consequences. Check the row count on the data source, instead, if you can.
Hi Mike,
maybe there is another event that is fired in such a case?e.g. a "RowsCountChanged" event or something like that, so I simply can do before and after comparison.
Hi,
There is no event for this in the grid. When you delete a row in the data source, the grid responds to a notification from the data source that a row was deleted. So in this case, the grid is a consumer of the event, not the source. Your best bet would be to hook into the events on the DataSource - you might need to cast it to an IBindingList.
Or, change your code so that it doesn't delete the row from the data source directly, but instead does it through the grid.