Observable Collection

  • 2 minutes to read

You are viewing documentation for the legacy WPF Scheduler control. If you're starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.

When you consider the type of item in a collection, make sure that its properties can be mapped to the Scheduler Storage fields in a straightforward way, i.e. the property value type must correspond to the data type used in the mapping. This rule prohibits the use of the ObservableCollection<T><Appointment,> collection as the data source because the mapping AppointmentMappingInfo.RecurrenceInfo requires mapped field of type string, not the RecurrenceInfo data type. Review the code snippet below for information of data types required for particular mappings.

Appointment and resource objects are represented by the ModelAppointment and ModelResource class instances as follows.

public class ModelAppointment {
    public DateTime StartTime { get; set; }
    public DateTime EndTime { get; set; }
    public string Subject { get; set; }
    public int Status { get; set; }
    public string Description { get; set; }
    public long Label { get; set; }
    public string Location { get; set; }
    public bool AllDay { get; set; }
    public int EventType { get; set; }
    public string RecurrenceInfo { get; set; }
    public string ReminderInfo { get; set; }
    public object ResourceId { get; set; }
    public decimal Price { get; set; }

    public ModelAppointment() {

public class ModelResource {
    public int Id { get; set; }
    public string Name { get; set; }
    public int Color { get; set; }

    public ModelResource() {

The SchedulerViewModel class exposes the generic collections of these objects (the ObservableCollection<ModelAppointment> and the ObservableCollection<ModelResource>) via its properties. The SchedulerViewModel class is specified as the window's data context. The DataSource properties of the AppointmentStorage and ResourceStorage instances are bound to the corresponding properties of the SchedulerViewModel in XAML.