Back to Devexpress

DxSchedulerAppointmentMappings Class

blazor-devexpress-dot-blazor-aa1aa6a2.md

latest5.5 KB
Original Source

DxSchedulerAppointmentMappings Class

Specifies how appointment fields from the data source are mapped to appointment properties in the Scheduler.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public class DxSchedulerAppointmentMappings :
    DxSchedulerMappingsBase

The following members return DxSchedulerAppointmentMappings objects:

Remarks

The Scheduler works with the DxSchedulerDataStorage object that contains source data for the following Scheduler persistent objects:

The DxSchedulerDataStorage defines property mappings that map data fields to persistent object properties. This class also includes API to retrieve persistent objects and to manage them.

The DxSchedulerAppointmentMappings object allows you to incorporate information on appointment items into the Scheduler. Follow the steps below to do this:

  1. In the Razor @code block, use the constructor without parameters to create a DxSchedulerDataStorage object.
  2. Declare a class (for instance, Appointment) that stores appointment options.
  3. Create a collection of status source objects (Appointment class instances) and define their options.
  4. Assign the newly created collection to the storage’s AppointmentsSource property to fill the storage with a collection of data objects.
  5. Assign a new DxSchedulerAppointmentMappings object to the DxSchedulerDataStorage.AppointmentMappings property. In this object, map the data source fields to appointment properties.
razor
<DxScheduler StartDate="@DateTime.Today" DataStorage="@DataStorage">
    <DxSchedulerWeekView ShowWorkTimeOnly="true"></DxSchedulerWeekView>
</DxScheduler>

@code {
    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
        AppointmentsSource = AppointmentCollection.GetAppointments(),
        AppointmentMappings = new DxSchedulerAppointmentMappings() {
            Start = "StartDate",
            End = "EndDate",
            Subject = "Caption",
            LabelId = "Label",
            StatusId = "Status",
        }
    };
}
csharp
public class Appointment {
    public Appointment() {}

    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }
    public string Caption { get; set; }
    public int Label { get; set; }
    public int Status { get; set; }
}
csharp
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;
    }
}

You can also map source object custom fields to a scheduler item’s custom properties. To do this, use the CustomFieldMappings property.

Run Demo: Scheduler - View Types

Run Demo: Scheduler - Recurring Appointments

Implements

INotifyPropertyChanged

Inheritance

Object DevExpress.Blazor.Scheduler.Internal.BindableBase DxSchedulerMappingsBase DxSchedulerAppointmentMappings

See Also

DxSchedulerAppointmentMappings Members

DevExpress.Blazor Namespace