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

InfiniteAsyncSource.FetchRows Event

Allows you to fetch rows.

Namespace: DevExpress.Xpf.Data

Assembly: DevExpress.Xpf.Core.v20.1.dll

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Core, DevExpress.Wpf.Core

Declaration

public event EventHandler<FetchRowsAsyncEventArgs> FetchRows

Event Data

The FetchRows event's data class is FetchRowsAsyncEventArgs. The following properties provide information specific to this event:

Property Description
AllowRetry Gets or sets whether re-requesting data is allowed. Inherited from FetchRowsEventArgsBase.
Filter Gets the GridControl filtering. Inherited from FetchEventArgsBase.
Keys Gets keys that you passed to the ReloadRows(Object[]) method.
Result Gets or sets the result of the fetch rows operation.
Skip Gets the number of rows to skip in a returned result set. Inherited from FetchEventArgsBase.
SkipToken Gets the skip token. Inherited from FetchEventArgsBase.
SortOrder Gets the GridControl‘s sorting. Inherited from FetchEventArgsBase.
Take

Gets one of the following values:

Inherited from FetchRowsEventArgsBase.

Remarks

To fetch rows from the data source:

public MainWindow() {
    // ...
    source.FetchRows += (o, e) => {
        e.Result = FetchRowsAsync(e);
    };
}
static async Task<FetchRowsResult> FetchRowsAsync(FetchRowsAsyncEventArgs e) {
  IssueSortOrder sortOrder = GetIssueSortOrder(e);
  IssueFilter filter = MakeIssueFilter(e.Filter);
  var take = e.Take ?? 30;
  var issues = await IssuesService.GetIssuesAsync(
    skip: e.Skip,
    take: take,
    sortOrder: sortOrder,
    filter: filter);
  return new FetchRowsResult(issues, hasMoreRows: issues.Length == take);
}
static IssueSortOrder GetIssueSortOrder(FetchRowsAsyncEventArgs e) {
    return IssueSortOrder.Default;
}
static IssueFilter MakeIssueFilter(CriteriaOperator filter) {
    return null;
}

VirtualSourceTutorialScrolling

The FetchRowsEventArgsBase.Take property returns the number of rows that should be reloaded. Use this property to allow the InfiniteAsyncSource to retain a selected row and scroll position after refresh. The PagedAsyncSource automatically retains a selected row and scroll position.

If data in your source are changed frequently, you can retain the same selected row after refresh. Specify the VirtualSourceBase.KeyProperty property to make a virtual source find the selected row by a specific field.

The following code snippets (auto-collected from DevExpress Examples) contain references to the FetchRows event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also