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

How to: Add Custom Labels and Statuses

  • 2 minutes to read

This code illustrates how to substitute default appointment labels and statuses with your own.

scheduler.Storage.Appointments.Clear();

string[] IssueList = { "Consultation", "Treatment", "X-Ray" };
Color[] IssueColorList = { Color.Ivory, Color.Pink, Color.Plum };
string[] PaymentStatuses = { "Paid", "Unpaid" };
Color[] PaymentColorStatuses = { Color.Green, Color.Red };


IAppointmentLabelStorage labelStorage = scheduler.Storage.Appointments.Labels;
labelStorage.Clear();
int count = IssueList.Length;
for (int i = 0; i < count; i++) {
    IAppointmentLabel label = labelStorage.CreateNewLabel(i, IssueList[i]);
    label.SetColor(IssueColorList[i]);
    labelStorage.Add(label);
}
AppointmentStatusCollection statusColl = scheduler.Storage.Appointments.Statuses;
statusColl.Clear();
count = PaymentStatuses.Length;
for (int i = 0; i < count; i++) {
    AppointmentStatus status = statusColl.CreateNewStatus(i, PaymentStatuses[i], PaymentStatuses[i]);
    status.SetBrush(new SolidBrush(PaymentColorStatuses[i]));
    statusColl.Add(status);
}