Skip to main content
A newer version of this page is available. .

DxSchedulerMappingsBase.CustomFieldMappings Property

Returns the collection of custom field mappings.

Namespace: DevExpress.Blazor.Base

Assembly: DevExpress.Blazor.v20.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public IEnumerable<DxSchedulerCustomFieldMapping> CustomFieldMappings { get; set; }

Property Value

Type Description
IEnumerable<DxSchedulerCustomFieldMapping>

The collection of custom field mappings.

Remarks

Scheduler items (DxSchedulerAppointmentItem, DxSchedulerAppointmentLabelItem, DxSchedulerAppointmentStatusItem) contain predefined sets of properties. When you bind a Scheduler to data, you map these properties to data source fields (see the AppointmentMappings, AppointmentLabelMappings, and AppointmentStatusMappings properties).

You can add custom properties to Scheduler items:

  1. Define custom fields in source objects.
  2. Add created fields to the CustomFieldMappings collection.

You can use custom properties in appointment templates to change appointment appearance. To obtain property values, use the CustomFields property. For example, the code below demonstrates how to:

public static partial class Appointment {
    public class Appointment {
        public Appointment() { }
        public int AppointmentType { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        //...
        // Custom field
        public bool Accepted { get; set; }
    }
}

Run Demo: Scheduler - Custom Fields and Appointment Form

Watch Video: Scheduler - Customization

The code below demonstrates how to add a custom field to LabelObject and map this field to the appointment label’s custom property:

@code {
    public class LabelObject {
        public int Id { get; set; }
        public string LabelName { get; set; }
        public System.Drawing.Color LabelColor { get; set; }
        public string MyCustomField { get; set; } // a custom field
    }

    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
        AppointmentLabelsSource = new List<LabelObject>() {
            new LabelObject() { 
                Id = 1, 
                LabelName = "Label One", 
                LabelColor = System.Drawing.Color.Aqua, 
                MyCustomField = "custom text for Label One" 
            },
            new LabelObject() { 
                Id = 2, 
                LabelName = "Label Two", 
                LabelColor = System.Drawing.Color.Beige, 
                MyCustomField = "custom text for Label Two"
            },
        },
        AppointmentLabelMappings = new DxSchedulerAppointmentLabelMappings() {
            Id = "Id",
            Caption = "LabelName",
            Color = "LabelColor",
            // Map the source object's custom field to the label's custom property
            CustomFieldMappings = new List<DxSchedulerCustomFieldMapping> {
                new DxSchedulerCustomFieldMapping { Name = "MyCustomProperty", Mapping = "MyCustomField" }
            }
        }
    };
}
See Also