Skip to main content
A newer version of this page is available. .

Frequent Data Updates

  • 3 minutes to read

You can use one of the following techniques to optimize data updates within the GridControl:

  • Speed up individual updates
  • Process updates in batches

View Example: How to Effectively Process Data Updates in WPF GridControl

Speed Up Individual Updates

ChunkList

The ChunkList<T> suits applications where you handle large collection updates. The ChunkList might work slower than ordinary collections if you perform multiple operations that iterate over data source items (for example, summary calculation, data sort and filter operations).

We recommend that you use the ChunkList in the following case:

  • The data source contains at least 10,000 elements.
  • One update operation affects a batch of elements in a collection.

Optimized Summaries

The GridControl recalculates all records to update data summaries. To optimize an update operation, set the GridControl.OptimizeSummaryCalculation property to true. In this case, the GridControl calculates values only for changed records and updates data summaries according to these values. Therefore, the performance does not depend on the number of records.

We recommend that you optimize summary calculation in the following case:

Process Updates in Batches

Data shaping operations allow you to sort, filter, and group data, and calculate summaries. The GridControl performs these operations when a data source change occurs. To process multiple updates as a single action, use one of the following methods:

Lock GridControl Updates

When you lock updates within the GridControl, a user cannot perform any data operations in the UI. You can process data updates and then apply all changes to the GridControl.

We recommend that you lock GridControl updates in the following case:

  • Your data source contains less than 100,000 elements. If the data source is too large, visible UI lags might appear.

  • A batch accumulates multiple updates.

Follow the steps below to apply this technique:

  1. Call the BeginDataUpdate method to lock data updates in the GridControl.
  2. Process multiple updates.
  3. Call the EndDataUpdate method to apply the changes.

The code sample below demonstrates how to prevent the GridControl from frequent updates when multiple data changes occur.

public void PerformUpdates() {
    gridControl.BeginDataUpdate();
    // Perform massive data updates...
    gridControl.EndDataUpdate();
}

Periodic Manual Refresh

Set the AllowLiveDataShaping property to false to allow the GridControl to ignore data shaping operations when data are changed. Call the RefreshData method to display all changes in the control.

We recommend that you force GridControl updates manually in the following case:

  • You store data in the List<T> collection.
  • Your data source contains less than 100,000 elements. If your source is too large, visible UI lags might appear.
  • You refresh the GridControl periodically, but not as soon as a data update occurs.

If you want to modify a data source from another thread, refer to the following topic: Manage Multi-Thread Data Updates.

See Also