Back to Devexpress

FetchDataEventArgs.AsyncResult Property

wpf-devexpress-dot-xpf-dot-scheduling-dot-fetchdataeventargs-11bd493f.md

latest3.5 KB
Original Source

FetchDataEventArgs.AsyncResult Property

Gets or sets a task that allows you to fetch data asynchronously in the SchedulerControl.

Namespace : DevExpress.Xpf.Scheduling

Assembly : DevExpress.Xpf.Scheduling.v25.2.dll

NuGet Package : DevExpress.Wpf.Scheduling

Declaration

csharp
public Task<object[]> AsyncResult { get; set; }
vb
Public Property AsyncResult As Task(Of Object())

Property Value

TypeDescription
Task<Object[]>

A task that allows you to fetch data asynchronously.

|

Remarks

The AsyncResult property is similar to the Result property, but allows you to fetch data asynchronously.

The code sample below illustrates how to use the asynchronous data fetch.

csharp
public void FetchAppointments(FetchDataEventArgs args) {
    args.AsyncResult = dbContext
        .AppointmentEntities
        .Where(args.GetFetchExpression<AppointmentEntity>())
        .ToArrayAsync<object>();
}
vb
Public Sub FetchAppointments(ByVal args As FetchDataEventArgs)
    Dim res = dbContext.AppointmentEntities.Where(args.GetFetchExpression(Of AppointmentEntity)())
    args.AsyncResult = QueryableExtensions.ToArrayAsync(Of Object)(res)
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AsyncResult property.

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.

wpf-scheduler-load-data-on-demand/CS/CommonDbContext/ViewModels/SchedulingViewModel.cs#L21

csharp
public void FetchAppointments(FetchDataEventArgs args) {
    args.AsyncResult = dbContext.AppointmentEntities.
        Where(args.GetFetchExpression<AppointmentEntity>()).

wpf-scheduler-load-data-on-demand/VB/CommonDbContext/ViewModels/SchedulingViewModel.vb#L23

vb
Dim res = dbContext.AppointmentEntities.Where(args.GetFetchExpression(Of AppointmentEntity)())
    args.AsyncResult = QueryableExtensions.ToArrayAsync(Of Object)(res)
End Sub

See Also

FetchDataEventArgs Class

FetchDataEventArgs Members

DevExpress.Xpf.Scheduling Namespace