Skip to main content

Appointment.LabelId Property

Gets or sets the index of the label object associated with the appointment.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v14.2.Core.dll

#Declaration

[DefaultValue(0)]
public int LabelId { get; set; }

#Property Value

Type Default Description
Int32

0

An integer value that specifies the index of the corresponding AppointmentLabel object within the AppointmentStorage.Labels collection.

#Remarks

The LabelId property specifies the collection item index of the AppointmentLabel object which specifies the identification label associated with an appointment. This index identifies the AppointmentLabel object within the AppointmentStorage.Labels collection. Use the LabelId property to assign the desired identification label from the AppointmentStorage.Labels collection to the current appointment.

The identification label is one of the appointment's basic visual characteristics. It is used for at-a-glance appointment identification. The appointment's identification label is indicated in the scheduler as a background color used to fill the client region of the rectangle occupied by the appointment (the color for each individual identification label object can be set via its AppointmentLabel.Color property).

If a SchedulerControl is used in bound mode (that is its data is stored in a database) the LabelId property's value may be taken from the data field specified by the AppointmentMapping.Label property (this property can be accessed via the AppointmentStorage.Mappings property of the AppointmentStorage object).

#Examples

This example demonstrates how to use the SchedulerControl.InitNewAppointment event, which occurs in all cases before a new appointment is created. This event is useful, for example, when it is necessary to initialize the newly created appointments with values other than the standard defaults.

The following code changes the all-day option for the newly created appointments to true, sets its label to Important and location - to "New office".

using DevExpress.XtraScheduler;
// ...

private void schedulerControl1_InitNewAppointment(object sender, AppointmentEventArgs e) {
   // Make the appointment all-day.
   e.Appointment.AllDay = true;

   // Set its label to "important".
   e.Appointment.LabelId = 1;

   // Set its location.
   e.Appointment.Location = "New office";
}
See Also