Back to Devexpress

FetchDataEventArgs.Ids Property

wpf-devexpress-dot-xpf-dot-scheduling-dot-fetchdataeventargs-6b22def9.md

latest4.0 KB
Original Source

FetchDataEventArgs.Ids Property

Returns the identifiers of scheduler items that have been reloaded by the ReloadAppointments/ReloadTimeRegions methods.

Namespace : DevExpress.Xpf.Scheduling

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

NuGet Package : DevExpress.Wpf.Scheduling

Declaration

csharp
public IReadOnlyList<object> Ids { get; }
vb
Public ReadOnly Property Ids As IReadOnlyList(Of Object)

Property Value

TypeDescription
IReadOnlyList<Object>

A list of objects that identify scheduler items to fetch.

|

Remarks

If you use the ReloadAppointments/ReloadTimeRegions methods to manually reload the scheduler items from the data source, the Ids property allows you to obtain the identifiers of the items.

If the fetch event has not been triggered by the ReloadAppointments/ReloadTimeRegions methods, the Ids property returns null.

The code snippet below illustrates the FetchAppointments event implementation.

csharp
scheduler.ReloadAppointment(new[] { id1, id2 });
//...
public void FetchAppointments(FetchDataEventArgs args) {
    using(var dbContext = new SchedulingContext()) {
      // event has been fired by the scheduler's initialization or navigation
        if(args.Ids == null)
            // load appointments based on the visible interval
            args.Result = dbContext.AppointmentEntities
                .Where(x => x.QueryStart <= args.Interval.End && x.QueryEnd >= args.Interval.Start)
                .ToArray();
        // event has been fired by the ReloadAppointments method
        else {
            var ids = args.Ids.OfType<int>().ToArray();
            // load the appointments whose identifiers are returned by the Ids property
            args.Result = dbContext.AppointmentEntities
                .Where((x) => ids.Contains(x.Id))
                .ToArray();
        }
    }
}
vb
scheduler.ReloadAppointment( { id1, id2 })
 '...
 Public Sub FetchAppointments(ByVal args As FetchDataEventArgs)
    Using dbContext = New SchedulingContext()
      ' event has been fired by the scheduler's initialization or navigation
        If args.Ids Is Nothing Then
            ' load appointments based on the visible interval
            args.Result = dbContext.AppointmentEntities.Where(Function(x) x.QueryStart <= args.Interval.End AndAlso x.QueryEnd >= args.Interval.Start).ToArray()
        ' event has been fired by the ReloadAppointments method
        Else
            Dim ids = args.Ids.OfType(Of Integer)().ToArray()
            ' load the appointments whose identifiers are returned by the Ids property
            args.Result = dbContext.AppointmentEntities.Where(Function(x) ids.Contains(x.Id)).ToArray()
        End If
    End Using
End Sub

See Also

FetchDataEventArgs Class

FetchDataEventArgs Members

DevExpress.Xpf.Scheduling Namespace