corelibraries-devexpress-dot-xtrascheduler-dot-ipersistentobject.md
Gets the collection of custom fields bound to the persistent object.
Namespace : DevExpress.XtraScheduler
Assembly : DevExpress.XtraScheduler.v25.2.Core.dll
NuGet Package : DevExpress.Scheduler.Core
[Browsable(false)]
CustomFieldCollection CustomFields { get; }
<Browsable(False)>
ReadOnly Property CustomFields As CustomFieldCollection
| Type | Description |
|---|---|
| CustomFieldCollection |
A CustomFieldCollection object representing the collection of the persistent object’s custom fields.
|
Use this property to access the custom fields associated to this persistent object (Appointment, Resource, AppointmentDependency).
The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomFields property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
get {
if (base.EditedAppointmentCopy.CustomFields["Amount"] != null)
return Convert.ToDecimal(base.EditedAppointmentCopy.CustomFields["Amount"]);
winforms-scheduler-print-appointments-using-reports/CS/PrintingViaReports/Form1.cs#L222
{
Color custColor = (Color)e.ViewInfo.Appointment.CustomFields["CustomColorField"];
// Change the appointment color if the custom color value is not default.
private void schedulerControl1_InitAppointmentImages(object sender, AppointmentImagesEventArgs e) {
if (e.Appointment.CustomFields["ApptImage1"] != null) {
byte[] imageBytes = (byte[])e.Appointment.CustomFields["ApptImage1"];
winforms-scheduler-create-appointments-on-reminder-alert/CS/ReminderCustomActions/Form1.cs#L50
Appointment app = schedulerDataStorage1.CreateAppointment(AppointmentType.Normal);
app.Subject = "Created on alert from appointment w/Price = " + e.AlertNotifications[0].ActualAppointment.CustomFields["CustomPrice"];
app.Start = e.AlertNotifications[0].ActualAppointment.Start.AddHours(2);
//ExtendedEvent obj = (ExtendedEvent)listEditor.SourceObjectHelper.GetSourceObject(appointment);
var referencePropertyValue = ((CustomReferenceTypeField)appointment.CustomFields["ReferenceField"])?.Name;
e.Text = $"{appointment.CustomFields["SimpleField"]} - {referencePropertyValue}";
Get
If MyBase.EditedAppointmentCopy.CustomFields("Amount") IsNot Nothing Then
Return Convert.ToDecimal(MyBase.EditedAppointmentCopy.CustomFields("Amount"))
winforms-scheduler-print-appointments-using-reports/VB/PrintingViaReports/Form1.vb#L198
Private Sub schedulerControl1_AppointmentViewInfoCustomizing(ByVal sender As Object, ByVal e As AppointmentViewInfoCustomizingEventArgs) Handles schedulerControl1.AppointmentViewInfoCustomizing
Dim custColor As Color = CType(e.ViewInfo.Appointment.CustomFields("CustomColorField"), Color)
' Change the appointment color if the custom color value is not default.
Private Sub schedulerControl1_InitAppointmentImages(ByVal sender As Object, ByVal e As AppointmentImagesEventArgs)
If e.Appointment.CustomFields("ApptImage1") IsNot Nothing Then
Dim imageBytes As Byte() = CType(e.Appointment.CustomFields("ApptImage1"), Byte())
winforms-scheduler-create-appointments-on-reminder-alert/VB/ReminderCustomActions/Form1.vb#L96
aptPattern.LabelKey = 2
aptPattern.CustomFields("CustomPrice") = CDec(15.25)
aptPattern.Start = Date.Now
winforms-scheduler-display-custom-tooltips/VB/Form1.vb#L29
ttiTitle.Text = "Appointment"
ttiBody.Text = String.Format("Subject: {0} " & Microsoft.VisualBasic.Constants.vbLf & "Description: {1}" & Microsoft.VisualBasic.Constants.vbLf & "Price: {2}", apt.Subject, apt.Description, apt.CustomFields("cfPrice"))
ttiBody.Image = SystemIcons.Information.ToBitmap()
See Also