AppointmentLabel.GetDefaultColorByStringId(SchedulerColorId) Method

Obtains a color from the legacy label color scheme.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v20.1.dll

Declaration

public static Color GetDefaultColorByStringId(
    SchedulerColorId colorId
)
Public Shared Function GetDefaultColorByStringId(
    colorId As SchedulerColorId
) As Color

Parameters

Name Type Description
colorId SchedulerColorId

A SchedulerColorId enumeration member that specifies a legacy Scheduler label whose color is obtained.

Returns

Type Description
Color

A Color that is the label color.

Remarks

The GetDefaultColorByStringId method allows you to obtain default label colors from the legacy color scheme, i.e., a default scheme unrelated to the current Skins.

Examples

This example changes the label colors. For each label it attempts to get a label color defined in a specified skin. If it fails, a default legacy color is used.

IAppointmentLabelStorage labelStorage = scheduler.Storage.Appointments.Labels;
foreach (IAppointmentLabel label in labelStorage) {
    AppointmentLabel appLabel = label as AppointmentLabel;
    if (appLabel != null) {
        string skinElemName = AppointmentLabel.GetSkinElementName(appLabel.ColorId);
        Color skinColor = DevExpress.Skins.SkinManager.Default.Skins["Office 2016 Colorful"].GetSkin(DevExpress.Skins.SkinProductId.Scheduler).Colors.GetPrimaryColor(skinElemName, Color.Empty);
        if (skinColor == Color.Empty)
            skinColor = AppointmentLabel.GetDefaultColorByStringId(appLabel.ColorId);
        appLabel.SetColor(skinColor);
    }

}
See Also