Back to Devexpress

IPersistentObject.CustomFields Property

corelibraries-devexpress-dot-xtrascheduler-dot-ipersistentobject.md

latest7.8 KB
Original Source

IPersistentObject.CustomFields Property

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

Declaration

csharp
[Browsable(false)]
CustomFieldCollection CustomFields { get; }
vb
<Browsable(False)>
ReadOnly Property CustomFields As CustomFieldCollection

Property Value

TypeDescription
CustomFieldCollection

A CustomFieldCollection object representing the collection of the persistent object’s custom fields.

|

Remarks

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.

winforms-scheduler-create-appointment-edit-form-with-custom-fields/CS/SimpleCustomFields/MyAppointmentForm.cs#L58

csharp
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

csharp
{
    Color custColor = (Color)e.ViewInfo.Appointment.CustomFields["CustomColorField"];
    // Change the appointment color if the custom color value is not default.

how-to-initialize-appointment-images-and-display-text-using-the-custom-field-values-t328320/CS/CustomAppointmentImageAndText/Form1.cs#L136

csharp
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

csharp
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);

xaf-how-to-display-an-event-with-custom-fields-in-a-scheduler-list-view/CS/EFCore/ExtendedEvents.Win/Controllers/SchedulerCustomFieldMappingsController.cs#L36

csharp
//ExtendedEvent obj = (ExtendedEvent)listEditor.SourceObjectHelper.GetSourceObject(appointment);
var referencePropertyValue = ((CustomReferenceTypeField)appointment.CustomFields["ReferenceField"])?.Name;
e.Text = $"{appointment.CustomFields["SimpleField"]} - {referencePropertyValue}";

winforms-scheduler-create-appointment-edit-form-with-custom-fields/VB/SimpleCustomFields/MyAppointmentForm.vb#L62

vb
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

vb
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.

how-to-initialize-appointment-images-and-display-text-using-the-custom-field-values-t328320/VB/CustomAppointmentImageAndText/Form1.vb#L127

vb
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

vb
aptPattern.LabelKey = 2
aptPattern.CustomFields("CustomPrice") = CDec(15.25)
aptPattern.Start = Date.Now

winforms-scheduler-display-custom-tooltips/VB/Form1.vb#L29

vb
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

Custom Fields

IPersistentObject Interface

IPersistentObject Members

DevExpress.XtraScheduler Namespace