Appointment Labels and Statuses
- 4 minutes to read
This document describes the appointment marks (labels and statuses), which can be used by end-users to graphically identify appointments in their schedules. By default, the label and status collections contain items that are similar to the corresponding marks in Microsoft® Outlook®, and can be used to bring the Outlook style to your scheduling application. However, you are also able to create your own custom labels and statuses. This document provides some examples on how to do this.
#Appointment Labels
An appointment's label is one of an appointment's basic visual characteristics. It is used for at-a-glance appointment identification. The appointment's label is displayed in the scheduler as a background color, which is used to fill the client region of the rectangle that represents the appointment.
The following picture illustrates what appointments with different labels look like.
An individual label is represented by the AppointmentLabel object. The label's display name and color can be accessed via its UserInterfaceObject.DisplayName and AppointmentLabel.Color properties, and all the labels are stored in the AppointmentStorage.Labels collection.
By default, the Labels collection is filled with the following labels.
Color | Display Name | Label |
---|---|---|
![]() |
None | 0 |
![]() |
Important | 1 |
![]() |
Business | 2 |
![]() |
Personal | 3 |
![]() |
Vacation | 4 |
![]() |
Must Attend | 5 |
![]() |
Travel Required | 6 |
![]() |
Needs Preparation | 7 |
![]() |
Birthday | 8 |
![]() |
Anniversary | 9 |
![]() |
Phone Call | 10 |
You can edit the Labels collection and customize existing labels, remove them, or add your own. This can be done both at design time and runtime.
To mark an appointment with a specific label at runtime, use the following code.
using System.Windows.Media;
using DevExpress.XtraScheduler;
using DevExpress.Xpf.Scheduler;
// ...
// Mark appointment as "Important".
apt.LabelId = 1;
// Add a new label to the collection.
AppointmentLabel lbl = new AppointmentLabel(Colors.Green, "LunchTime", "&LunchTime");
schedulerControl1.Storage.AppointmentStorage.Labels.Add(lbl);
// Find the label by its name and assign to an appointment.
AppointmentLabel aptLbl = (AppointmentLabel)schedulerControl1.Storage.AppointmentStorage.Labels.Find
(delegate(AppointmentLabel l) { return l.DisplayName == "LunchTime"; });
apt.LabelId = schedulerControl1.Storage.AppointmentStorage.Labels.IndexOf(aptLbl);
NOTE
You can handle the Scheduler
NOTE
Instead of using labels, you can paint an appointment background by applying custom templates to appointments.
#Appointment Statuses
The appointment's availability status is one of an appointment's visual characteristics (marks). It is used for at-a-glance appointment identification. The availability status is indicated in the scheduler as a strip displayed on an appointment rectangle's left side. The strip is colored according to the status type, as illustrated in the following picture.
NOTE
Availability statuses are only visible under the Day View or Work-Week View.
An individual status is represented by the AppointmentStatus object. A status's display name and color can be specified via its UserInterfaceObject.DisplayName and AppointmentStatus.Color properties. Statuses are stored in the AppointmentStorage.Statuses collection.
By default, the Statuses collection contains the following items.
Standard Color | Standard Display Name |
---|---|
![]() |
Free |
![]() |
Tentative |
![]() |
Busy |
![]() |
Out Of Office |
The default values for the Statuses collection items are the same as availability statuses in Microsoft® Outlook®. However, you are able to edit this collection and customize the existing statuses, remove them, or add your own custom statuses. This can be done both at design time and runtime.
For example, to add items to the collection of appointment statuses at design time, add the following code to the XAML markup.
<dxsch:AppointmentStorage>
<dxsch:AppointmentStorage.Statuses>
<dxsch:AppointmentStatus Color="YellowGreen" DisplayName="Reserved" MenuCaption="Reserved"/>
<dxsch:AppointmentStatus Color="Green" DisplayName="Confirmed" MenuCaption="Confirmed"/>
</dxsch:AppointmentStorage.Statuses>
</dxsch:AppointmentStorage>
To mark an appointment with the specified availability status at runtime, use the GetStandardStatusId method of the AppointmentStatusBaseCollection object accessed via SchedulerControl.GetCoreStorage().Appointments.Statuses if you don't know the index of the status item. Otherwise, you can set it directly via the Appointment.StatusId property.
using DevExpress.XtraScheduler;
// ...
apt.StatusId = schedulerControl1.GetCoreStorage().Appointments.Statuses.GetStandardStatusId
(AppointmentStatusType.OutOfOffice);
NOTE
You can handle the Scheduler