Back to Devexpress

SchedulerControl.CustomAppointmentTemplateValue Event

windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-b09d4fdc.md

latest2.7 KB
Original Source

SchedulerControl.CustomAppointmentTemplateValue Event

Allows you to assign custom values to HTML elements bound to data fields.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public event EventHandler<CustomAppointmentTemplateValueEventArgs> CustomAppointmentTemplateValue
vb
Public Event CustomAppointmentTemplateValue As EventHandler(Of CustomAppointmentTemplateValueEventArgs)

Event Data

The CustomAppointmentTemplateValue event's data class is DevExpress.XtraScheduler.CustomAppointmentTemplateValueEventArgs.

Remarks

You can use the ${} syntax to bind HTML elements to data source or Appointment fields (for example, `` or <div>${Appointment.CustomFields.Position}</div>). You can handle the CustomAppointmentTemplateValue event to replace values retrieved by such data-bound elements.

Use the e.Appointment and e.FieldName properties to find a placeholder for data-bound values, and set the e.FieldValue property to assign your custom value.

The following sample assigns the “No Details” description to appointments that do not have any descriptions.

html
...
<div>${Appointment.Description}</div>
...
csharp
private void OnCustomAppointmentTemplateValue(object sender, CustomAppointmentTemplateValueEventArgs e) {
    if (e.Appointment.Description == String.Empty && e.FieldName == "Appointment.Description")
        e.FieldValue = "No Details";
}
vb
Private Sub OnCustomAppointmentTemplateValue(ByVal sender As Object, ByVal e As CustomAppointmentTemplateValueEventArgs)
    If e.Appointment.Description = String.Empty AndAlso e.FieldName = "Appointment.Description" Then
        e.FieldValue = "No Details"
    End If
End Sub

Refer to this help article for more information: HTML Templates in Scheduler.

See Also

SchedulerControl Class

SchedulerControl Members

DevExpress.XtraScheduler Namespace