blazor-devexpress-dot-blazor-dot-dxschedulerdatastorage.md
Specifies an appointment data source.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
public IEnumerable AppointmentsSource { get; set; }
| Type | Description |
|---|---|
| IEnumerable |
A collection of objects with appointment data.
|
Follow the steps below to bind the Scheduler component to data:
AppointmentsSource property to fill the storage with a collection of data objects.Note
IEnumerable is a base interface for all non-generic collections that can be enumerated. This base interface does not support modifications. If you want to create an editable collection of appointments (with add/delete operations), use IEnumerable descendants that support modifications, such as IList.
<DxScheduler StartDate="@DateTime.Today" DataStorage="@DataStorage">
<DxSchedulerWeekView ShowWorkTimeOnly="true"></DxSchedulerWeekView>
</DxScheduler>
@code {
DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
AppointmentsSource = AppointmentCollection.GetAppointments(),
AppointmentMappings = new DxSchedulerAppointmentMappings() {
Type = "AppointmentType",
Start = "StartDate",
End = "EndDate",
Subject = "Caption",
AllDay = "AllDay",
Location = "Location",
Description = "Description",
LabelId = "Label",
StatusId = "Status",
RecurrenceInfo = "Recurrence"
}
};
}
public class Appointment {
public Appointment() {}
public int AppointmentType { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public string Caption { get; set; }
public string Description { get; set; }
public string Location { get; set; }
public int Label { get; set; }
public int Status { get; set; }
public bool AllDay { get; set; }
public string Recurrence { get; set; }
}
public static partial class AppointmentCollection {
public static List<Appointment> GetAppointments() {
DateTime date = DateTime.Today;
var dataSource = new List<Appointment>() {
new Appointment {
Caption = "Install New Router in Dev Room",
StartDate = date + (new TimeSpan(0, 10, 0, 0)),
EndDate = date + (new TimeSpan(0, 12, 0, 0)),
Label = 6,
Status = 1
},
new Appointment {
Caption = "Upgrade Personal Computers",
StartDate = date + (new TimeSpan(0, 13, 0, 0)),
EndDate = date + (new TimeSpan(0, 14, 30, 0)),
Label = 1,
Status = 1
},
new Appointment {
Caption = "Website Redesign Plan",
StartDate = date + (new TimeSpan(1, 9, 30, 0)),
EndDate = date + (new TimeSpan(1, 11, 30, 0)),
Label = 1,
Status = 1
},
// ...
};
return dataSource;
}
}
Run Demo: Scheduler - View Types
Run Demo: Scheduler - Recurring Appointments
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AppointmentsSource 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.
blazor-scheduler-custom-form/CS/DxBlazorApplication1/Components/Pages/Index.razor.cs#L70
Storage.TimeZone = TimeZoneInfo.Utc;
Storage.AppointmentsSource = await AptService.GetAppointmentsAsync();
Storage.ResourcesSource = await ResService.GetResourcesAsync();
See Also