Custom Fields

  • 2 minutes to read
NOTE

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.

You can define any number of mappings to data source fields that are not used by the Scheduler itself. The content of these fields is available via the PersistentObject.CustomFields property of the Appointment and Resource objects.

To bind a data field ("CustomField1") to the appointment custom field ("MyNote"), use the following code:

this.schedulerStorage1.Appointments.CustomFieldMappings.Add(new AppointmentCustomFieldMapping("MyNote", "CustomField1"));

To access "MyNote" data for the selected appointment, use the following code:

object note = schedulerControl1.SelectedAppointments[0].CustomFields["MyNote"];

Custom Field Mappings should not use names from the list of the standard appointment properties (see the Appointment Mappings document) if the Scheduler operates in unbound mode. For example, the following mapping may result in incorrect appointment processing:

AppointmentCustomFieldMapping customNameMapping = new AppointmentCustomFieldMapping("MyCustomIdField", "Id");
schedulerStorage.Appointments.CustomFieldMappings.Add(customNameMapping);

because "Id" is the name of the standard appointment property.