RealTimeSource Class

The component that acts as an asynchronous bridge between a data-aware control and rapidly changing data.

Namespace: DevExpress.Data

Assembly: DevExpress.Data.v19.2.dll

Declaration

[ToolboxBitmap(typeof(ResFinder), "Bitmaps256.RealTimeSource.bmp")]
public class RealTimeSource :
    Component,
    IListSource,
    IDXCloneable
<ToolboxBitmap(GetType(ResFinder), "Bitmaps256.RealTimeSource.bmp")>
Public Class RealTimeSource
    Inherits Component
    Implements IListSource,
               IDXCloneable

Remarks

The RealTimeSource performs event marshaling between different threads (if needed), merges or reorders changes to achieve better performance, and throttles changes to achieve smoothness. As a result, the bound control stays responsive even if there are tens of thousands of changes per second in the underlying data source.

RealTimeSource

Use Cases and Limitations

  • The RealTimeSource should be used in applications where you are required to display a high frequency of data updates (tens of thousands of updates per second). Do not use this with static data, or when there are no performance issues with the directly connected control.
  • Editing data at runtime is not supported.
  • The RealTimeSource does not track database changes itself - it is bound to its data source and has no direct connection to a database. So, the RealTimeSource does not receive notifications that the database was changed. It is necessary to update the data source from your database manually to refresh the displayed data.

Bind a Data-Aware Control to Data using the RealTimeSource

NOTE

The complete example for the WinForms Data Grid is provided in the Data Grid and Editors demo. Run this demo and choose Performance | Real-Time Data in the navigation panel. A sample project for the WPF Data Grid can be downloaded from the How to use RealTimeSource Code Example.

To use the RealTimeSource, create an instance of this class and initialize the RealTimeSource.DataSource property. Then, use the created RealTimeSource object as the control's data source (e.g., assign it to the GridControl.DataSource or DataControlBase.ItemsSource property).


grid.ItemsSource = new RealTimeSource { DataSource = Items };

In this case, the Items is a list or collection that provides IBindingList.ListChanged, INotifyCollectionChanged.CollectionChanged and/or INotifyPropertyChanged.PropertyChanged events to be handled by the RealTimeSource (e.g., ObservableCollection<T>). For instance, it can be a collection of Entity Framework objects bound to data, or a list of unbound objects that are generated in code. You can limit the visible properties set using the RealTimeSource.DisplayableProperties property. If you want to track only the list changes and ignore modifications of particular property values, set the RealTimeSource.IgnoreItemEvents property to true.

You can put the RealTimeSource component on a form like any other component. To use the RealTimeSource in the designer, drag-and-drop it from the DX.19.2: Data & Analytics toolbox category to the form where the grid control is located (below is an example for the WinForms Data Grid control).

RealTimeSource_AddFromToolbox

Set the grid control's DataSource to realTimeSource1 using the GridControl Tasks smart tag panel (or in the Properties window).

RealTimeSource_GridDataSource

Then, use the RealTimeSource Tasks smart tag panel or the Properties window to set the actual data source to the RealTimeSource.DataSource property.

RealTimeSource_DataSource

As a result, the data will be bridged to the grid by the RealTimeSource component.

Inheritance

See Also