[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Expand]Grid View Data Layout
   [Collapse]Binding to Data
     Binding to Data Overview
     Binding to ICollectionView
     Virtual Source, Server Mode, Instant Feedback Components
    [Expand]Server Mode
    [Collapse]Binding to any Data Source with Virtual Sources
      Virtual Sources Overview
      Infinite and Paged Virtual Sources
      Regular and Async Virtual Sources
      Virtual Sources Limitations
     [Expand]How to Use Virtual Sources
     [Expand]How to Bind to a Custom Service with Restrictions
      How to Bind to IQueryable
      How to Use Skip Tokens to Optimize Paging
      Examples
    [Expand]TreeListView Data Binding
     Applying Data Annotations
     Unbound Columns
     Managing Multi-Thread Data Updates
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Filtering and Searching
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus, Navigation, Selection
   [Expand]Drag-and-Drop
   [Expand]Conditional Formatting
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Regular and Async Virtual Sources

Expanded Regular Sources

The GridControl supports the following regular sources:

Virtual Source Description Example
InfiniteSource The infinite source. How to Bind to InfiniteSource
PagedSource The paged source. How to Bind to PagedSource

Workflow

Regular virtual sources raise events consecutively in the UI Thread and process data in a single separate Working Thread.

The image below illustrates the workflow:

  1. The virtual source creates a single separate Working Thread to process data.
  2. The virtual source raises the InfiniteSource.CreateSource (or PagedSource.CreateSource) event. Handle this event to create an object used to request data (e.g., DbContext (see System.Data.Entity.DbContext) for EF, UnitOfWork for XPO).
  3. The virtual source raises the InfiniteSource.GetTotalSummaries (or PagedSource.GetTotalSummaries) event. Handle this event and process summaries if you want to show them in the GridControl.
  4. The virtual source raises the InfiniteSource.FetchRows (or PagedSource.FetchPage) event to get the first portion of data.
  5. When end-users navigate to the next page, the virtual source raises the InfiniteSource.FetchRows (or PagedSource.FetchPage) event to get the next portion of data.
  6. When end-users apply a filter, the virtual source raises the InfiniteSource.GetUniqueValues (or PagedSource.GetUniqueValues) event to get unique values and show them in a drop-down filter.
Note

Only values of the Char, SByte, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, Double, Decimal, DateTime, String, Guid, Enum types are available in the UI Thread.

For other types, the UI Thread creates thread-safe proxy objects. You can allow access to these values in the following ways:

Expanded Async Sources

The GridControl supports the following async sources:

Virtual Source Description Example
InfiniteAsyncSource The asynchronous infinite source. How to Bind to InfiniteAsyncSource
PagedAsyncSource The asynchronous paged source. How to Bind to PagedAsyncSource

Workflow

Async virtual sources raise events in the UI Thread and process data in parallel Working Threads. You have to provide tasks to these events to obtain summaries, rows, etc.

The image below illustrates the workflow:

  1. The virtual source raises the InfiniteAsyncSource.GetTotalSummaries (or PagedAsyncSource.GetTotalSummaries) event. Handle this event and process summaries if you want to show them in the GridControl.
  2. The virtual source raises the InfiniteAsyncSource.FetchRows (or PagedAsyncSource.FetchPage) event to get the first portion of data.
  3. When end-users navigate to the next page, the virtual source raises the InfiniteAsyncSource.FetchRows (or PagedAsyncSource.FetchPage) event to get the next portion of data.
  4. When end-users apply a filter, the virtual source raises the InfiniteAsyncSource.GetUniqueValues (or PagedAsyncSource.GetUniqueValues) event to get unique values and show them in a drop-down filter.
Note

Async virtual sources have the following advantages because they fetch rows in parallel threads:

  • You do not have to wait for rows to be loaded to show summaries.
  • If you quickly move from one page to another, the PagedAsyncSource loads all data pages. The PagedSource loads only the last page and throttles requests to other pages.

When to Use Async Sources

Use the async virtual sources in the following cases:

  • Case 1

    A data source supports asynchrony (for example, .NET MongoDB Driver provides methods to perform multiple requests at the same time).

  • Case 2

    You can create a new data access object (for example, DbContext (see System.Data.Entity.DbContext)) for every request.

    Note

    Do not use async sources if a data access object

    • is created for a long time, or
    • takes an extensive amount of time to perform the first request.

Is this topic helpful?​​​​​​​