1
votes

I'm using a DevExpress XtraGrid component and a DataTable as the data source.

I'd like to update the data (asynchronously) every few seconds but I don't want to scroll/collapse/change the grid.

For example, if a user has scrolled the grid and I perform a background update, then I want the user to stay on the same row, etc.

1

1 Answers

1
votes

I think that you can use the following approach:

  1. Use BindingSource as a datasource for GridControl and disable BindingSource.RaiseListChangedEvents option. This will allow you to prevent your datasource from sending notifications to GridControl. As a result, GridControl will not update itself automatically on each change.

  2. On updating your datasource, save updated row indexes.

  3. Finally, introduce a timer with interval equal, for example, five seconds, and call the RefreshRow method to refresh only requiered rows. Also, you can refresh all rows using the RefreshDataSource method.

As a result, you will update only required rows once in five seconds and row states will be saved.