Mappings
- 2 minutes to read
Appointments, resources, labels, and other elements have required and optional data-bound properties. For instance, appointment start and end dates, ID, and type are required properties, whereas time zone ID, status, subject, reminder, etc., are optional. Tables in the following articles enumerate all bindable properties of Scheduler elements, and state which of these properties are required.
Set Mappings
Use the Mappings Wizard to set up mappings at design time.
You can also set object mappings in code.
private void MapAppointmentData()
{
//required mappings
schedulerDataStorage1.Appointments.Mappings.End = "EndDate";
schedulerDataStorage1.Appointments.Mappings.Start = "StartDate";
//optional mappings
schedulerDataStorage1.Appointments.Mappings.AllDay = "AllDay";
//. . .
schedulerDataStorage1.Appointments.Mappings.ResourceId = "ResourceIDs";
//custom fields
schedulerDataStorage1.Appointments.CustomFieldMappings.Add(
new AppointmentCustomFieldMapping("MyNote", "CustomField1"));
}
Mapping Converters
A data field type can mismatch the type a Scheduler element property expects. For example, in the Getting Started article, cars are Resources. Cars have categories (“Truck”, “SUV”, etc.) and Resources have colors, thus you may want to bind the “Car Category” field to the ResourceMappingInfo.Color property so that cars that belong to the same categories have the same colors. Since string category names are not what the Color
property expects (ARGB values, OLE colors, etc.), you cannot map this property directly.
In cases like this, use Mapping Converters to dynamically convert data between the two types.
Custom Fields
Besides standard properties that can be mapped to data source fields, Scheduler elements provide custom field collections. These collections allow you to store values of data source fields that are not used by the Scheduler.
You can use data stored in custom fields in any way you like. Below are a few examples.
- How to display custom field values inside Appointment blocks
- How to filter appointments depending on custom field values
- How to use custom appointment fields in a custom editing form