Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XPO (eXpress Persistent Objects)

  • 3 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.

A Scheduler Storage can be bound to an XPCollection object provided by the eXpress Persistent Objects suite. For example, the following code demonstrates how to implement custom appointment and resource classes, which are the XPObject class descendants.

using DevExpress.Xpo;
using DevExpress.Xpo.Metadata;
// ...

public class CustomAppointment : XPObject {
    public CustomAppointment(Session session) : base(session) { }

    public int AppointmentType;
    public DateTime StartDate;
    public DateTime EndDate;
    public bool AllDay;
    public string Subject;
    public string Location;
    [Size(SizeAttribute.Unlimited)]
    public string Description;
    public int Status;
    public long Label;
    [Size(SizeAttribute.Unlimited)]
    public string RecurrenceInfo;
    [Size(SizeAttribute.Unlimited)]
    public string ReminderInfo;
    [Size(SizeAttribute.Unlimited)]
    public string CustomField1;

    public CustomResource Resource;
}

public class CustomResource : XPObject {
    public CustomResource(Session session) : base(session) { }

    [Size(SizeAttribute.Unlimited)]
    public string ResourceName;
    [ValueConverter(typeof(ColorValueConverter))]
    public Color Color;
    public Image Image;
    [Size(SizeAttribute.Unlimited)]
    public string CustomField1;
}

public class ColorValueConverter : ValueConverter {
    public override Type StorageType { get { return typeof(Int32); } }
    public override object ConvertToStorageType(object value) {
        if (!(value is Color)) return null;
        return ((Color)value).ToArgb();
    }
    public override object ConvertFromStorageType(object value) {
        if (!(value is Int32)) return null;
        return Color.FromArgb((Int32)value);
    }
}