Skip to main content

Virtual Sources

  • 3 minutes to read

Overview

The InfiniteAsyncSource is an asynchronous virtual source that allows you to bind the GridControl to any data source even if the total record count is unknown. The GridControl only requests the top records, and you can specify required data operations supported by the data source.

WinUI Grid - Virtual Sources

Complete Example

View Example: Data Grid - Bind to InfiniteAsyncSource

Bind to any Data Source

You can use the InfiniteAsyncSource to connect the GridControl to any data source: REST Services, NoSQL Databases, Custom WCF Services, EntityFramework, or any other ORM.

WinUI Grid - Virtual Sources Bind To Any Data

Minimum Requirement

The data source should conatain an API to fetch portions of data consecutively (for example, Skip and Take). Virtual sources do not require a total item count, and sorting, filtering, and summary calculation operations are optional.

Enable Features

The GridControl bound to a virtual source only requests the top records. You can specify which data operations are allowed (for example, a user can sort by columns A, C, and D, and the Fixed Summary Panel can display the last created object’s date and time).

Virtual sources allow you to control requests that the GridControl sends to a service or database. You can exclude non-optimal queries to avoid database overload. The GridControl hides all UI elements for non-supported operations.

Refer to the following help topic for more information: Virtual Sources Limitations.

Workflow

The InfiniteAsyncSource raises events in the UI Thread and uses tasks to process data in parallel working threads. Specify tasks in the event handlers to obtain rows, summaries, and so on.

The image below illustrates the workflow:

WinUI Grid - Async Workflow

  1. The virtual source raises the InfiniteAsyncSource.GetTotalSummaries event. Handle this event and process summaries to show them in the GridControl.
  2. The virtual source raises the InfiniteAsyncSource.FetchRows event to get the first portion of data.
  3. When a user scrolls the grid, the virtual source raises the InfiniteAsyncSource.FetchRows event to get the next portion of data.
  4. When a user opens a column’s drop-down filter, the virtual source raises the InfiniteAsyncSource.GetUniqueValues event to get unique values and show them in the drop-down filter.

Tutorial Steps

This step-by-step tutorial demonstrates how to use the InfiniteAsyncSource.