All docs
V20.2
20.2 (EAP/Beta)
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
You are viewing help content for pre-release software. This document and the features it describes are subject to change.

DataSource.FetchAppointments Event

Allows you to o load appointments only for the specified date range and resources.

Namespace: DevExpress.Xpf.Scheduling

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

Declaration

public event FetchDataEventHandler FetchAppointments
Public Event FetchAppointments As FetchDataEventHandler

Event Data

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

Property Description
Ids Returns the identifiers of appointments to fetch.
Interval Returns the time range for which to fetch the appointments.
ResourceIds Returns the identifiers of resources for which to fetch the appointments.
Result Specifies the list of appointments to load from the data source.

Remarks

Specify AppointmentMappings.QueryStart and AppointmentMappings.QueryEnd mappings to handle the FetchAppointments event.

These mappings allow you to calculate the correct interval that is used in a SELECT query when you handle the FetchAppointments event. The use of the AppointmentMappings.Start and AppointmentMappings.End properties is not recommended in this scenario because such an interval may not include appointment patterns and the corresponding appointment exceptions.

The example below illustrates how to fetch appointments from a DbContext source.

public class SchedulingDataContext : DbContext {
    public SchedulingDataContext() : base(CreateConnection(), true) { }
    static DbConnection CreateConnection() {
        //...
    }
    public DbSet<AppointmentEntity> AppointmentEntities { get; set; }

    //...
}
private void dataSource_FetchAppointments(object sender, DevExpress.Xpf.Scheduling.FetchDataEventArgs e) {
    using (var dbContext = new SchedulingDataContext()) {
        e.Result = dbContext.AppointmentEntities
            .Where(x => x.QueryStart <= e.Interval.End
                && x.QueryEnd > e.Interval.Start)
            .ToArray();
    }
}
See Also